Skip to content

Commit 836bb60

Browse files
committed
improve env var usage in check-change-note.yml
1 parent 0bfa53c commit 836bb60

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

.github/workflows/check-change-note.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,22 @@ on:
1515

1616
jobs:
1717
check-change-note:
18+
env:
19+
REPO: ${{ github.repository }}
20+
PULL_REQUEST_NUMBER: ${{ github.event.number }}
21+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1822
runs-on: ubuntu-latest
1923
steps:
24+
2025
- name: Fail if no change note found. To fix, either add one, or add the `no-change-note-required` label.
2126
if: |
2227
github.event.pull_request.draft == false &&
2328
!contains(github.event.pull_request.labels.*.name, 'no-change-note-required')
24-
env:
25-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2629
run: |
27-
gh api 'repos/${{github.repository}}/pulls/${{github.event.number}}/files' --paginate --jq 'any(.[].filename ; test("/change-notes/.*[.]md$"))' |
30+
gh api "repos/$REPO/pulls/$PULL_REQUEST_NUMBER/files" --paginate --jq 'any(.[].filename ; test("/change-notes/.*[.]md$"))' |
2831
grep true -c
32+
2933
- name: Fail if the change note filename doesn't match the expected format. The file name must be of the form 'YYYY-MM-DD.md', 'YYYY-MM-DD-{title}.md', where '{title}' is arbitrary text, or released/x.y.z.md for released change-notes
30-
env:
31-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3234
run: |
33-
gh api 'repos/${{github.repository}}/pulls/${{github.event.number}}/files' --paginate --jq '[.[].filename | select(test("/change-notes/.*[.]md$"))] | all(test("/change-notes/[0-9]{4}-[0-9]{2}-[0-9]{2}.*[.]md$") or test("/change-notes/released/[0-9]*[.][0-9]*[.][0-9]*[.]md$"))' |
35+
gh api "repos/$REPO/pulls/$PULL_REQUEST_NUMBER/files" --paginate --jq '[.[].filename | select(test("/change-notes/.*[.]md$"))] | all(test("/change-notes/[0-9]{4}-[0-9]{2}-[0-9]{2}.*[.]md$") or test("/change-notes/released/[0-9]*[.][0-9]*[.][0-9]*[.]md$"))' |
3436
grep true -c

0 commit comments

Comments
 (0)