Skip to content

Commit

Permalink
fixed fatimage and ci not running on target branch
Browse files Browse the repository at this point in the history
  • Loading branch information
wtripp180901 committed Jan 6, 2025
1 parent 921b565 commit 726dba2
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 2 deletions.
21 changes: 21 additions & 0 deletions .github/actions/is_callee/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Check if being used as reusable workflow
description: Determines if running as part of a reusable workflow by checking if the specified current workflow file is the same as the caller
inputs:
current_workflow_file:
required: true
description: The name of the workflow file this action is called from
outputs:
is_callee:
value: ${{ steps.workflows_match.outputs.is_callee }}
description: Returns 'true' (string) if called as a reusable workflow
runs:
using: "composite"
steps:
- id: workflows_match
run: |
if echo ${{ github.workflow_ref }} | grep ${{ inputs.current_workflow_file }}; then
echo "is_callee='false'" >> "$GITHUB_OUTPUT"
else
echo "is_callee='true'" >> "$GITHUB_OUTPUT"
fi
shell: bash
7 changes: 6 additions & 1 deletion .github/workflows/fatimage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,14 @@ jobs:
openhpc-RL9-image: "${{ steps.manifest.outputs.openhpc-RL9-image }}"

steps:
- uses: stackhpc/ansible-slurm-appliance/.github/actions/is_callee@feat/auto-bump-timestamps # todo: change to main once merges
id: callee_check
with:
current_workflow_file: fatimage.yml

- uses: actions/checkout@v3
with:
ref: ${{ github.event_name != 'workflow_call' && github.ref || inputs.target_branch }}
ref: ${{ steps.callee_check.outputs.is_callee && inputs.target_branch || github.ref }}

- name: Record settings for CI cloud
run: |
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/stackhpc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,14 @@ jobs:
CI_CLOUD: ${{ vars.CI_CLOUD }} # default from repo settings
TF_VAR_os_version: ${{ matrix.os_version }}
steps:
- uses: stackhpc/ansible-slurm-appliance/.github/actions/is_callee@feat/auto-bump-timestamps # todo: change to main once merges
id: callee_check
with:
current_workflow_file: stackhpc.yml

- uses: actions/checkout@v3
with:
ref: ${{ github.event_name != 'workflow_call' && github.ref || inputs.target_branch }}
ref: ${{ steps.callee_check.outputs.is_callee && inputs.target_branch || github.ref }}

- name: Override CI_CLOUD if PR label is present
if: ${{ github.event_name == 'pull_request' }}
Expand Down

0 comments on commit 726dba2

Please sign in to comment.