aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/remove-merge-needed-label.yml
diff options
context:
space:
mode:
authornea <romangraef@gmail.com>2022-10-27 21:57:39 +0200
committernea <romangraef@gmail.com>2022-10-27 21:57:39 +0200
commitd747f7115230ad819d679642025729433667f7e3 (patch)
tree2ae514297b51fed4b67da4f38de5cde5567505c7 /.github/workflows/remove-merge-needed-label.yml
parent8832bff4c5e61fb1019b8ad13cec636dd7b0dd44 (diff)
downloadNotEnoughUpdates-remove-label.tar.gz
NotEnoughUpdates-remove-label.tar.bz2
NotEnoughUpdates-remove-label.zip
Diffstat (limited to '.github/workflows/remove-merge-needed-label.yml')
-rw-r--r--.github/workflows/remove-merge-needed-label.yml32
1 files changed, 32 insertions, 0 deletions
diff --git a/.github/workflows/remove-merge-needed-label.yml b/.github/workflows/remove-merge-needed-label.yml
new file mode 100644
index 00000000..0ff57523
--- /dev/null
+++ b/.github/workflows/remove-merge-needed-label.yml
@@ -0,0 +1,32 @@
+name: Remove merge label
+
+on:
+ - pull_request_target
+
+
+permissions:
+ contents: read
+ pull-requests: write
+
+jobs:
+ check-mergability:
+ env:
+ GH_TOKEN:
+ ${{ secrets.GITHUB_TOKEN }}
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v3
+ with:
+ fetch-depth: 0
+ - run: |
+ echo This is the merginator 2000 speaking, i am now checking your mergability
+ if git merge-tree "$(git merge-base ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }})" ${{ github.event.pull_request.head.sha }} "${{ github.event.pull_request.base.sha }}" | grep "^<<<<<<<\|changed in both" >/dev/null; then
+ echo "This PR is deemed: dirty :("
+ echo "{\"labels\":[\"$MERGE_LABEL\"]}"|gh api -X POST --input - "$ISSUE_PATH" || true
+ else
+ echo This PR is deemed: clean!
+ gh api -X DELETE $ISSUE_PATH/$MERGE_LABEL || true
+ fi
+ env:
+ MERGE_LABEL: needs-merge
+ ISSUE_PATH: /repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/labels