diff --git a/.github/workflows/milestone.yml b/.github/workflows/milestone.yml new file mode 100644 index 000000000..cf1be8e5b --- /dev/null +++ b/.github/workflows/milestone.yml @@ -0,0 +1,43 @@ +--- +name: Add milestone and project to GitHub PR +on: + pull_request: + branches: [main] + workflow_dispatch: +permissions: read-all +jobs: + milestone: + name: Add milestone to GitHub PR + if: github.actor == 'renovate[bot]' + runs-on: ubuntu-24.04 + steps: + - name: Find current milestone and add it to GitHub PR + uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 + with: + script: | + try { + const { data: [milestones] } = await github.issues.listMilestones({ + owner: context.repo.owner, + repo: context.repo.repo, + }); + + await github.issues.update({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + milestone: milestone.number, + }); + } catch (error) { + core.setFailed(`Action failed with error ${error}`); + } + + project: + name: Add project to GitHub PR + if: github.actor == 'renovate[bot]' + runs-on: ubuntu-24.04 + steps: + - name: Add Project + uses: actions/add-to-project@244f685bbc3b7adfa8466e08b698b5577571133e # v.1.0.2 + with: + project-url: https://github.com/orgs/nginxinc/projects/17/views/1 + github-token: ${{ secrets.ADD_TO_PROJECT_TOKEN }} diff --git a/CHANGELOG.md b/CHANGELOG.md index fef88e3de..6575b91c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -41,6 +41,7 @@ CI/CD: - Remove platform metadata from the Ansible Galaxy role metadata since platforms are no longer supported in Ansible Galaxy NG. - Implement OSSF Scorecard. - Implement Renovate Bot. +- Automatically add milestone and project to Renovate Bot PRs. ## 0.24.3 (July 11, 2024)