Skip to content

Commit 4fe557c

Browse files
committed
ci: Auto add milestone/project to Renovate PRs
1 parent d240eea commit 4fe557c

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed

.github/workflows/milestone.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
---
2+
name: Add milestone and project to GitHub PR
3+
on:
4+
pull_request:
5+
branches: [main]
6+
workflow_dispatch:
7+
permissions: read-all
8+
jobs:
9+
milestone:
10+
name: Add milestone to GitHub PR
11+
if: github.actor == 'renovate[bot]'
12+
runs-on: ubuntu-24.04
13+
permissions:
14+
issues: write
15+
pull-requests: write
16+
steps:
17+
- name: Find current milestone and add it to GitHub PR
18+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
19+
with:
20+
script: |
21+
try {
22+
const { data: [milestone] } = await github.rest.issues.listMilestones({
23+
owner: context.repo.owner,
24+
repo: context.repo.repo,
25+
});
26+
27+
console.log(`Current milestone: ${milestone.title} (${milestone.number})`);
28+
29+
await github.rest.issues.update({
30+
owner: context.repo.owner,
31+
repo: context.repo.repo,
32+
issue_number: context.issue.number,
33+
milestone: milestone.number,
34+
});
35+
} catch (error) {
36+
core.setFailed(`Action failed with error ${error}`);
37+
}
38+
39+
project:
40+
name: Add project to GitHub PR
41+
if: github.actor == 'renovate[bot]'
42+
runs-on: ubuntu-24.04
43+
steps:
44+
- name: Add Project
45+
uses: actions/add-to-project@244f685bbc3b7adfa8466e08b698b5577571133e # v.1.0.2
46+
with:
47+
project-url: https://github.com/orgs/nginxinc/projects/17/views/1
48+
github-token: ${{ secrets.ADD_TO_PROJECT_TOKEN }}

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ CI/CD:
4141
- Remove platform metadata from the Ansible Galaxy role metadata since platforms are no longer supported in Ansible Galaxy NG.
4242
- Implement OSSF Scorecard.
4343
- Implement Renovate Bot.
44+
- Automatically add milestone and project to Renovate Bot PRs.
4445

4546
## 0.24.3 (July 11, 2024)
4647

0 commit comments

Comments
 (0)