Skip to content

Commit e246b63

Browse files
authored
Add check for release notes update. (#582)
All PRs merging to `main` must either modify `release_build_files/readme.md` or contain the label `skip-release-notes`.
1 parent 45beab3 commit e246b63

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

.github/workflows/checks.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ env:
99
triggerLabelQuick: "tests-requested: quick"
1010
statusLabelInProgress: "tests: in-progress"
1111
statusLabelFailed: "tests: failed"
12+
skipReleaseNotesLabel: "skip-release-notes"
1213

1314
jobs:
1415
file_format_check:
@@ -92,3 +93,33 @@ jobs:
9293
run: |
9394
set -e
9495
bash scripts/gha/check_copyright.sh -g
96+
97+
release_notes_check:
98+
# Check that the readme was updated, unless the PR has a specific label set (env.skipReleaseNotesLabel).
99+
runs-on: ubuntu-latest
100+
steps:
101+
- uses: actions/checkout@v2
102+
# Skip this if the PR has the skipReleaseNotes label or if it's a merge to other than main.
103+
if: ${{!contains(github.event.pull_request.labels.*.name, env.skipReleaseNotesLabel) && (github.event.pull_request.base.ref == 'main')}}
104+
with:
105+
fetch-depth: 0
106+
submodules: false
107+
- name: Check whether release notes have been updated
108+
# Skip this if the PR has the skipReleaseNotes label or if it's a merge to other than main.
109+
if: ${{!contains(github.event.pull_request.labels.*.name, env.skipReleaseNotesLabel) && (github.event.pull_request.base.ref == 'main')}}
110+
run: |
111+
set -e
112+
# Filename to check.
113+
README_FILE=release_build_files/readme.md
114+
# Determine the github merge base - same logic as integration_tests.yml
115+
# "git merge-base main branch_name" will give the common ancestor of both branches.
116+
MERGE_BASE=$(git merge-base origin/${{github.event.pull_request.head.ref}} origin/${{github.event.pull_request.base.ref}} || true)
117+
# If MERGE_BASE can't be determined, ignore this check, something odd is going on.
118+
if [[ -n "${MERGE_BASE}" ]]; then
119+
DIFF_RESULT=$(git diff --name-only "origin/${{github.event.pull_request.head.ref}}..${MERGE_BASE}" -- "${README_FILE}")
120+
if [[ "${DIFF_RESULT}" != "${README_FILE}" ]]; then
121+
echo "::error ::Please update release notes (${README_FILE}) or add '${{env.skipReleaseNotesLabel}}' label."
122+
exit 1
123+
fi
124+
fi
125+

0 commit comments

Comments
 (0)