Skip to content

Commit a32f559

Browse files
committed
Fix workflow_dispatch: check out PR head before running, accept .yaml extension
1 parent 757de75 commit a32f559

2 files changed

Lines changed: 15 additions & 2 deletions

File tree

.github/workflows/pr-check.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,22 @@ jobs:
2626
with:
2727
fetch-depth: 0
2828

29+
- name: Check out PR head for manual runs
30+
if: github.event_name == 'workflow_dispatch'
31+
run: |
32+
PR_REF=$(gh pr view ${{ inputs.pr_number }} --repo ${{ github.repository }} --json headRefName --jq '.headRefName')
33+
git fetch origin "$PR_REF"
34+
git checkout FETCH_HEAD -- ${{ inputs.tool_files }}
35+
env:
36+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37+
2938
- name: Get changed tool files
3039
id: changed
3140
run: |
3241
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
3342
FILES="${{ inputs.tool_files }}"
3443
else
35-
FILES=$(git diff --name-only --diff-filter=A origin/master...HEAD -- 'data/tools/*.yml' | tr '\n' ' ')
44+
FILES=$(git diff --name-only --diff-filter=A origin/master...HEAD -- 'data/tools/*.yml' 'data/tools/*.yaml' | tr '\n' ' ')
3645
fi
3746
echo "files=$FILES" >> "$GITHUB_OUTPUT"
3847

ci/pr-check/src/main.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,11 @@ async fn main() -> Result<()> {
427427
let tool_paths: Vec<PathBuf> = tool_paths
428428
.into_iter()
429429
.filter(|p| {
430-
p.starts_with("data/tools") && p.extension().and_then(|e| e.to_str()) == Some("yml")
430+
p.starts_with("data/tools")
431+
&& matches!(
432+
p.extension().and_then(|e| e.to_str()),
433+
Some("yml") | Some("yaml")
434+
)
431435
})
432436
.collect();
433437

0 commit comments

Comments
 (0)