Skip to content

Commit 8f5eecd

Browse files
google-labs-jules[bot]greenc-FNAL
authored andcommitted
refactor: Make workflows reusable for external repositories
This change refactors the GitHub Actions workflows to support 'workflow_call' triggers, making them self-contained and portable for use in external repositories. Key changes: - Added 'workflow_call' triggers to all relevant workflows with inputs to configure behavior like checkout paths, build matrices, and relevance check skipping. - Replaced hardcoded 'phlex' references with dynamic repository information. - Ensured workflows remain backward-compatible with existing triggers. - Fixed an issue with constructing CMake sanitizer options by correctly extracting the repository name from the full 'owner/repo' string. - Corrected the relevance check in `actionlint-check.yaml` to handle pull request context from `workflow_call`. - Updated workflows to explicitly check out the 'phlex' repository for ancillary scripts or to use canonical remote paths for reusable actions, ensuring they are self-contained.
1 parent db9d583 commit 8f5eecd

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

.github/workflows/cmake-format-fix.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ jobs:
7575
gersemi -i ${{ env.local-checkout-path }}
7676
7777
- name: Handle fix commit
78-
uses: ./${{ env.local-checkout-path }}/.github/actions/handle-fix-commit
78+
uses: Framework-R-D/phlex/.github/actions/handle-fix-commit@main
7979
with:
8080
tool: cmake-format
8181
working-directory: phlex-src

.github/workflows/codeql-analysis.yaml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,14 @@ jobs:
135135
with:
136136
fetch-depth: 0
137137

138+
- name: Checkout Phlex for scripts
139+
if: github.event_name == 'workflow_call'
140+
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
141+
with:
142+
repository: Framework-R-D/phlex
143+
path: phlex
144+
fetch-depth: 0
145+
138146
- name: Download CodeQL SARIF artifacts
139147
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
140148
with:
@@ -161,7 +169,12 @@ jobs:
161169
if [ -n "$PR_NUMBER" ]; then
162170
ARGS+=(--ref "refs/pull/${PR_NUMBER}/merge")
163171
fi
164-
python3 scripts/check_codeql_alerts.py "${ARGS[@]}"
172+
173+
script_path="scripts/check_codeql_alerts.py"
174+
if [ "${{ github.event_name }}" = "workflow_call" ]; then
175+
script_path="phlex/$script_path"
176+
fi
177+
python3 "$script_path" "${ARGS[@]}"
165178
166179
- name: Upload CodeQL alerts debug log
167180
if: always()

.github/workflows/python-fix.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ jobs:
7979
ruff check --fix . || true
8080
8181
- name: Handle fix commit
82-
uses: ./${{ env.local-checkout-path }}/.github/actions/handle-fix-commit
82+
uses: Framework-R-D/phlex/.github/actions/handle-fix-commit@main
8383
with:
8484
tool: 'Python linting'
8585
working-directory: phlex-src

0 commit comments

Comments
 (0)