Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:

permissions:
contents: read
pull-requests: read

jobs:
changelog-check:
Expand All @@ -17,11 +18,16 @@ jobs:
- name: Require Unreleased CHANGELOG.md additions or override label
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
LABELS: ${{ toJSON(github.event.pull_request.labels.*.name) }}
GH_TOKEN: ${{ github.token }}
PR_NUMBER: ${{ github.event.pull_request.number }}
REPO: ${{ github.repository }}
run: |
set -euo pipefail

if grep -q '"skip-changelog"' <<< "$LABELS"; then
# Pull request events can run out of order, so use the current labels
# rather than the labels captured when this event was created.
labels=$(gh api "repos/$REPO/pulls/$PR_NUMBER" --jq '.labels[].name')
if grep -Fxq 'skip-changelog' <<< "$labels"; then
echo "Found 'skip-changelog' label; no CHANGELOG.md entry required."
exit 0
fi
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ This is the default file for all Temporal OSS repos. Primarily we offer:
`changelog.yml` verifies that a pull request adds to a `CHANGELOG.md` only
within its Unreleased section. Repositories retain a small caller workflow so
label changes can rerun the check and the `skip-changelog` override remains
available.
available. Callers grant `contents: read` for checkout and `pull-requests: read`
so the shared workflow can read the pull request's current labels.


## Why do this
Expand Down