mirror of
https://github.com/kyverno/kyverno.git
synced 2024-12-14 11:57:48 +00:00
chore: update milestone check (#10346)
Signed-off-by: ShutingZhao <shuting@nirmata.com>
This commit is contained in:
parent
8341c8dca8
commit
ba618897ff
2 changed files with 32 additions and 39 deletions
32
.github/workflows/check-milestone-label.yaml
vendored
Normal file
32
.github/workflows/check-milestone-label.yaml
vendored
Normal file
|
@ -0,0 +1,32 @@
|
|||
name: check-milestone-label
|
||||
|
||||
permissions: {}
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- 'main'
|
||||
types:
|
||||
- opened
|
||||
- synchronize
|
||||
- edited
|
||||
- reopened
|
||||
- labeled
|
||||
- unlabeled
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
check_labels:
|
||||
name: Check milestone label for pull request
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.actor != 'dependabot[bot]' }} # dependabot prs do not have to be in milestone
|
||||
steps:
|
||||
- name: require milestone label for pull request
|
||||
uses: docker://agilepathway/pull-request-label-checker:latest
|
||||
with:
|
||||
prefix_mode: true
|
||||
one_of: "milestone"
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
39
.github/workflows/check-milestone.yaml
vendored
39
.github/workflows/check-milestone.yaml
vendored
|
@ -1,39 +0,0 @@
|
|||
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
|
||||
|
||||
name: check-milestone
|
||||
|
||||
permissions: {}
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- 'main'
|
||||
types:
|
||||
- opened
|
||||
- demilestoned
|
||||
- milestoned
|
||||
- edited
|
||||
- synchronize
|
||||
|
||||
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.`);
|
||||
}
|
Loading…
Reference in a new issue