Skip to content

Commit ef4d962

Browse files
Adds a mandatory CHANGELOG.md file that PRs have to update (allenai#1276)
* Added changelog and PR check * Integrated quality check with pr_checks. * added changelog description * Updated changelog with PR link. * Cleaned up changelog check. * Fixed bug that cursor pointed out. * Update CHANGELOG.md * now changelog has the same default
1 parent 22cefba commit ef4d962

File tree

3 files changed

+90
-27
lines changed

3 files changed

+90
-27
lines changed

.github/workflows/pr_checks.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: PR Checks
2+
3+
concurrency:
4+
group: ${{ github.workflow }}-${{ github.ref }}
5+
cancel-in-progress: true
6+
7+
on:
8+
pull_request:
9+
branches:
10+
- main
11+
merge_group:
12+
13+
jobs:
14+
changelog:
15+
name: CHANGELOG
16+
runs-on: ubuntu-latest
17+
if: github.event_name == 'pull_request'
18+
defaults:
19+
run:
20+
shell: bash -euo pipefail {0}
21+
22+
steps:
23+
- uses: actions/checkout@v4
24+
with:
25+
fetch-depth: 0
26+
27+
- name: Check that CHANGELOG has been updated
28+
env:
29+
PR_BODY: ${{ github.event.pull_request.body }}
30+
run: |
31+
if echo "$PR_BODY" | grep -q 'CHANGELOG='; then
32+
REASON=$(echo "$PR_BODY" | grep -oP 'CHANGELOG=\K[^\n\r]*' | head -1)
33+
echo "CHANGELOG check bypassed. Reason: $REASON"
34+
exit 0
35+
fi
36+
37+
# Only require changelog for open_instruct/** changes
38+
if ! git diff --name-only $(git merge-base origin/main HEAD) | grep -q '^open_instruct/'; then
39+
echo "No open_instruct/ changes detected, skipping CHANGELOG check"
40+
exit 0
41+
fi
42+
43+
CHANGELOG_DIFF=$(git diff $(git merge-base origin/main HEAD) -- CHANGELOG.md)
44+
if [ -z "$CHANGELOG_DIFF" ]; then
45+
echo "ERROR: Changes to open_instruct/ detected but CHANGELOG.md was not updated."
46+
exit 1
47+
fi
48+
49+
PR_URL="${{ github.event.pull_request.html_url }}"
50+
if ! echo "$CHANGELOG_DIFF" | grep -q "$PR_URL"; then
51+
echo "ERROR: CHANGELOG.md was updated but does not include the PR URL: $PR_URL"
52+
echo "Please add a link to this PR in your changelog entry."
53+
exit 1
54+
fi
55+
56+
echo "Thanks for helping keep our CHANGELOG up-to-date!"
57+
58+
code-quality:
59+
name: Code Quality
60+
runs-on: ubuntu-latest
61+
defaults:
62+
run:
63+
shell: bash -euo pipefail {0}
64+
65+
steps:
66+
- uses: actions/checkout@v4
67+
68+
- name: Install uv
69+
uses: astral-sh/setup-uv@v4
70+
with:
71+
version: "0.8.8"
72+
73+
- name: Style check
74+
run: make style-check
75+
76+
- name: Quality check
77+
run: make quality-check

.github/workflows/quality.yml

Lines changed: 0 additions & 27 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
6+
### Added
7+
- Added a new changelog Github Action that makes sure you contribute to the changelog! https://github.com/allenai/open-instruct/pull/1276
8+
9+
### Changed
10+
11+
### Fixed
12+
13+
### Removed

0 commit comments

Comments
 (0)