From c3e92333426c91c05850dd63ae7cd90acdb1c4fa Mon Sep 17 00:00:00 2001 From: "Luis (LT) Carbonell" Date: Mon, 19 Dec 2022 12:38:41 -0600 Subject: [PATCH] Add GitHub action to check for a milestone (#18406) * Add GitHub action to check for a milestone * Update comment * Cleanup * Add config * move config to own directory --- .github/configs/milestone-check.json | 8 ++++++ .github/workflows/milestone-checker.yml | 33 +++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 .github/configs/milestone-check.json create mode 100644 .github/workflows/milestone-checker.yml diff --git a/.github/configs/milestone-check.json b/.github/configs/milestone-check.json new file mode 100644 index 0000000000..a06049b153 --- /dev/null +++ b/.github/configs/milestone-check.json @@ -0,0 +1,8 @@ +[ + { + "type": "check-milestone", + "title": "Milestone Check", + "success": "Milestone set", + "failure": "Milestone not set" + } + ] \ No newline at end of file diff --git a/.github/workflows/milestone-checker.yml b/.github/workflows/milestone-checker.yml new file mode 100644 index 0000000000..77ff50b8cf --- /dev/null +++ b/.github/workflows/milestone-checker.yml @@ -0,0 +1,33 @@ +# This workflow checks that there is either a 'pr/no-milestone' label applied to a PR +# or there is a milestone associated with a PR + +name: Check Milestone + +on: + pull_request: + types: [opened, synchronize, labeled, unlabeled] + # Runs on PRs to main and release branches + branches: + - main + - release/** + +jobs: + # checks that a milestone entry is present for a PR + milestone-check: + # If there a `pr/no-milestone` label we ignore this check + if: "!contains(github.event.pull_request.labels.*.name, 'pr/no-milestone')" + runs-on: ubuntu-latest + steps: + - name: Checkout Actions + uses: actions/checkout@v2 + with: + repository: "grafana/grafana-github-actions" + path: ./actions + ref: main + - name: Install Actions + run: npm install --production --prefix ./actions + - name: Run PR Checks + uses: ./actions/pr-checks + with: + token: ${{secrets.GITHUB_TOKEN}} + configPath: configs/milestone-check \ No newline at end of file