Compare commits

...

30 commits

Author SHA1 Message Date
Matthew Phillips
45758451ee Add another change to test if the review happens twice 2022-09-23 09:35:44 -04:00
Matthew Phillips
79d036513e empty string 2022-09-23 09:32:33 -04:00
Matthew Phillips
cf5cffe2be strings 2022-09-23 09:24:53 -04:00
Matthew Phillips
3ce3370c38 only run if not already blocked 2022-09-23 09:20:13 -04:00
Matthew Phillips
c8fef3e3ae wrap the contents maybe 2022-09-23 09:15:22 -04:00
Matthew Phillips
267ba4d113 echo the count of blocked reviews 2022-09-23 09:11:21 -04:00
Matthew Phillips
eba1323050 should be a number 2022-09-23 08:55:53 -04:00
Matthew Phillips
226fa15a79 check if the bot left a review 2022-09-23 08:51:10 -04:00
Matthew Phillips
bb54cc3bd9 echo the raw content 2022-09-23 08:45:25 -04:00
Matthew Phillips
80a669765c debug, get current reviews 2022-09-23 08:44:27 -04:00
Matthew Phillips
971559dd11 better json 2022-09-23 08:25:28 -04:00
Matthew Phillips
a197189a26 should be issues 2022-09-23 08:19:56 -04:00
Matthew Phillips
e08fb43336 try again 2022-09-23 08:16:09 -04:00
Matthew Phillips
fa3960e664 remove old one 2022-09-23 08:15:01 -04:00
Matthew Phillips
9fce6f4821 some more testing 2022-09-23 08:14:21 -04:00
Matthew Phillips
6c17cdca45 verify patch doesn't trigger it 2022-09-22 17:02:47 -04:00
Matthew Phillips
02b4664c70 maybe fixed 2022-09-22 17:01:48 -04:00
Matthew Phillips
64f72d6cf2 try fetch-depth: 2 2022-09-22 17:01:12 -04:00
Matthew Phillips
0b66dd9913 debugging 2022-09-22 16:54:40 -04:00
Matthew Phillips
eecff58bbc Make it be minor 2022-09-22 16:52:31 -04:00
Matthew Phillips
c590adc9c1 Add a patch changeset 2022-09-22 16:50:40 -04:00
Matthew Phillips
66c9a11210 Use outputs 2022-09-22 16:47:57 -04:00
Matthew Phillips
511485fdc6 Fix the if condition 2022-09-22 16:39:10 -04:00
Matthew Phillips
e515100f8c list files 2022-09-22 16:36:28 -04:00
Matthew Phillips
a7e200ef11 add checkout 2022-09-22 16:34:34 -04:00
Matthew Phillips
a66497202d fix formatting 2022-09-22 16:31:49 -04:00
Matthew Phillips
1bd3c29aa6 fix yaml error 2022-09-22 16:26:47 -04:00
Matthew Phillips
5807402348 Testing if there's a changed file 2022-09-22 16:23:04 -04:00
Matthew Phillips
d37f02b80a Try again 2022-09-22 15:39:39 -04:00
Matthew Phillips
a6d53e06fe Block a merge when the PR is marked as minor 2022-09-22 15:22:56 -04:00
2 changed files with 77 additions and 0 deletions

View file

@ -0,0 +1,8 @@
---
'astro': minor
---
Just a test again
- more stuff here
- another change

69
.github/workflows/check-merge.yml vendored Normal file
View file

@ -0,0 +1,69 @@
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:
- name: Retrieve existing PR reviews
id: set-reviews
run: |
echo ::set-output name=reviews::$(curl --request GET \
--url https://api.github.com/repos/${{github.repository}}/pulls/${{github.event.number}}/reviews \
--header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}')
- name: Check if there is already a block on this PR
id: set-blocks
run: |
echo ::set-output name=blocks::$(echo '${{ steps.set-reviews.outputs.reviews }}' \
| jq '.[] | select(.user.id == 41898282 and .state == "CHANGES_REQUESTED") | length' \
| uniq)
- uses: actions/checkout@v3
if: steps.set-blocks.outputs.blocks == ''
with:
fetch-depth: 0
- name: Get changed files in the .changeset folder
id: changed-files
uses: tj-actions/changed-files@v29
if: steps.set-blocks.outputs.blocks == ''
with:
files: |
.changeset/**/*.md
- name: Check if any changesets contain minor changes
id: find-blockers
if: steps.set-blocks.outputs.blocks == ''
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}}/issues/${{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."}'