Skip to content

Commit 726dba2

Browse files
committed
fixed fatimage and ci not running on target branch
1 parent 921b565 commit 726dba2

File tree

3 files changed

+33
-2
lines changed

3 files changed

+33
-2
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Check if being used as reusable workflow
2+
description: Determines if running as part of a reusable workflow by checking if the specified current workflow file is the same as the caller
3+
inputs:
4+
current_workflow_file:
5+
required: true
6+
description: The name of the workflow file this action is called from
7+
outputs:
8+
is_callee:
9+
value: ${{ steps.workflows_match.outputs.is_callee }}
10+
description: Returns 'true' (string) if called as a reusable workflow
11+
runs:
12+
using: "composite"
13+
steps:
14+
- id: workflows_match
15+
run: |
16+
if echo ${{ github.workflow_ref }} | grep ${{ inputs.current_workflow_file }}; then
17+
echo "is_callee='false'" >> "$GITHUB_OUTPUT"
18+
else
19+
echo "is_callee='true'" >> "$GITHUB_OUTPUT"
20+
fi
21+
shell: bash

.github/workflows/fatimage.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,14 @@ jobs:
5454
openhpc-RL9-image: "${{ steps.manifest.outputs.openhpc-RL9-image }}"
5555

5656
steps:
57+
- uses: stackhpc/ansible-slurm-appliance/.github/actions/is_callee@feat/auto-bump-timestamps # todo: change to main once merges
58+
id: callee_check
59+
with:
60+
current_workflow_file: fatimage.yml
61+
5762
- uses: actions/checkout@v3
5863
with:
59-
ref: ${{ github.event_name != 'workflow_call' && github.ref || inputs.target_branch }}
64+
ref: ${{ steps.callee_check.outputs.is_callee && inputs.target_branch || github.ref }}
6065

6166
- name: Record settings for CI cloud
6267
run: |

.github/workflows/stackhpc.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,14 @@ jobs:
4949
CI_CLOUD: ${{ vars.CI_CLOUD }} # default from repo settings
5050
TF_VAR_os_version: ${{ matrix.os_version }}
5151
steps:
52+
- uses: stackhpc/ansible-slurm-appliance/.github/actions/is_callee@feat/auto-bump-timestamps # todo: change to main once merges
53+
id: callee_check
54+
with:
55+
current_workflow_file: stackhpc.yml
56+
5257
- uses: actions/checkout@v3
5358
with:
54-
ref: ${{ github.event_name != 'workflow_call' && github.ref || inputs.target_branch }}
59+
ref: ${{ steps.callee_check.outputs.is_callee && inputs.target_branch || github.ref }}
5560

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

0 commit comments

Comments
 (0)