Skip to content

Commit cdbf826

Browse files
committed
feat(workflows): add fragments check workflow (feature/changelog)
1 parent 80d67b2 commit cdbf826

1 file changed

Lines changed: 16 additions & 4 deletions

File tree

.github/workflows/fragments-check.yml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,21 @@ jobs:
2020

2121
- name: Check if linked to the correct pull request
2222
run: |
23-
git remote -v
24-
git branch -r
2523
diff=$(git diff origin/${{ github.base_ref }} HEAD --name-only)
26-
changelog_fragments=$(echo "$diff" | grep "^.changes/unreleased/")
27-
echo $changelog_fragments
24+
changelog_fragments=$(echo "$diff" | grep "^.changes/unreleased/.*\.yaml$")
25+
pr_number=${{ github.event.pull_request.number }}
26+
found_match=false
27+
28+
for file in $changelog_fragments; do
29+
if grep -qE "PR: *\"?$pr_number\"?" "$file"; then
30+
echo "✅ Found PR number $pr_number in $file"
31+
found_match=true
32+
fi
33+
done
34+
35+
if [ "$found_match" = false ]; then
36+
echo "❌ No matching PR number found in changelog fragments."
37+
exit 1
38+
fi
2839
40+

0 commit comments

Comments
 (0)