Skip to content

Commit 2e7f05b

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

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

.github/workflows/milestone.yml

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

CHANGELOG.md

+1
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)