Skip to content

Commit

Permalink
chore: add a job to check the PR milestone is set (kyverno#9966)
Browse files Browse the repository at this point in the history
* chore: add a job to check the PR milestone is set

Signed-off-by: Mariam Fahmy <[email protected]>

* Update .github/workflows/check-milestone.yaml

Co-authored-by: Vishal Choudhary <[email protected]>
Signed-off-by: Mariam Fahmy <[email protected]>

* Update .github/workflows/check-milestone.yaml

Co-authored-by: Vishal Choudhary <[email protected]>
Signed-off-by: Mariam Fahmy <[email protected]>

* Update .github/workflows/check-milestone.yaml

Co-authored-by: Vishal Choudhary <[email protected]>
Signed-off-by: Mariam Fahmy <[email protected]>

* fix: remove the release branch from the milestone check

Signed-off-by: Mariam Fahmy <[email protected]>

---------

Signed-off-by: Mariam Fahmy <[email protected]>
Signed-off-by: Mariam Fahmy <[email protected]>
Co-authored-by: Vishal Choudhary <[email protected]>
  • Loading branch information
MariamFahmy98 and vishal-chdhry authored Mar 30, 2024
1 parent 9123642 commit b671411
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/check-milestone.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json

name: check-milestone

permissions: {}

on:
pull_request:
branches:
- 'main'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
check-milestone:
runs-on: ubuntu-latest
steps:
- name: Check milestone
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
script: |
const { data } = await github.request("GET /repos/{owner}/{repo}/pulls/{pr}", {
owner: context.repo.owner,
repo: context.repo.repo,
pr: context.payload.pull_request.number
});
if (data.milestone) {
core.info(`This pull request has a milestone set: ${data.milestone.title}`);
} else {
core.setFailed(`A milestone need to be set on this pull request.`);
}

0 comments on commit b671411

Please sign in to comment.