From 9fce6f48217f2be60005266db00766f94e903b91 Mon Sep 17 00:00:00 2001 From: Matthew Phillips Date: Fri, 23 Sep 2022 08:14:21 -0400 Subject: [PATCH] some more testing --- .changeset/eighty-countries-fry.md | 2 +- .github/workflows/check-merge.yml | 52 ++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/check-merge.yml diff --git a/.changeset/eighty-countries-fry.md b/.changeset/eighty-countries-fry.md index a27838052..31b31990b 100644 --- a/.changeset/eighty-countries-fry.md +++ b/.changeset/eighty-countries-fry.md @@ -1,5 +1,5 @@ --- -'astro': patch +'astro': minor --- Just a test again diff --git a/.github/workflows/check-merge.yml b/.github/workflows/check-merge.yml new file mode 100644 index 000000000..1cc6f20a0 --- /dev/null +++ b/.github/workflows/check-merge.yml @@ -0,0 +1,52 @@ +name: Check mergeability + +on: pull_request # run on pull request events + +permissions: + # grant write permission on the pull-requests endpoint + pull-requests: write +jobs: + check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Get changed files in the .changeset folder + id: changed-files + uses: tj-actions/changed-files@v29 + with: + files: | + .changeset/**/*.md + + - name: Check if any changesets contain minor changes + id: find-blockers + run: | + echo "Checking for changesets marked as minor" + echo '::set-output name=found::false' + for file in ${{ steps.changed-files.outputs.all_changed_files }}; do + if grep -q "'astro': minor" "$file"; then + echo '::set-output name=found::true' + echo "$file has a minor release tag" + fi + done + + - name: Add label + if: steps.find-blockers.outputs.found == 'true' + run: | + curl --request POST \ + --url https://api.github.com/repos/${{github.repository}}/pulls/${{github.event.number}}/labels + --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \ + --header 'content-type: application/json' \ + -d '{["semver minor"]}' + + + - name: Send PR review + if: steps.find-blockers.outputs.found == 'true' + run: | # approve the pull request + curl --request POST \ + --url https://api.github.com/repos/${{github.repository}}/pulls/${{github.event.number}}/reviews \ + --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \ + --header 'content-type: application/json' \ + -d '{"event":"REQUEST_CHANGES","body":"This PR is blocked because it contains a `minor` changeset. A reviewer will merge this at the next release if approved."}'