Skip to content

Commit 0576343

Browse files
authored
Merge pull request #2239 from larrybradley/gh-checks
Add GHA checks for milestone and change log
2 parents 5f641f4 + 702e4df commit 0576343

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Check PR change log
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, labeled, unlabeled]
6+
7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.ref }}
9+
cancel-in-progress: true
10+
11+
permissions:
12+
pull-requests: read
13+
14+
jobs:
15+
changelog_checker:
16+
name: Check if change log entry is correct
17+
runs-on: ubuntu-latest
18+
if: github.repository == 'astropy/photutils'
19+
steps:
20+
- uses: scientific-python/action-check-changelogfile@1fc669db9618167166d5a16c10282044f51805c0 # 0.3
21+
env:
22+
CHANGELOG_FILENAME: CHANGES.rst
23+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Check PR milestone
2+
3+
on:
4+
pull_request:
5+
types: [synchronize, milestoned, demilestoned]
6+
7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.ref }}
9+
cancel-in-progress: true
10+
11+
permissions:
12+
pull-requests: read
13+
14+
jobs:
15+
# https://stackoverflow.com/questions/69434370/how-can-i-get-the-latest-pr-data-specifically-milestones-when-running-yaml-jobs
16+
milestone_checker:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
20+
if: github.repository == 'astropy/photutils'
21+
with:
22+
github-token: ${{ secrets.GITHUB_TOKEN }}
23+
script: |
24+
const { data } = await github.request("GET /repos/{owner}/{repo}/pulls/{pr}", {
25+
owner: context.repo.owner,
26+
repo: context.repo.repo,
27+
pr: context.payload.pull_request.number
28+
});
29+
if (data.milestone) {
30+
core.info(`This pull request has a milestone set: ${data.milestone.title}`);
31+
} else {
32+
core.setFailed(`A maintainer needs to set the milestone for this pull request.`);
33+
}

0 commit comments

Comments
 (0)