diff options
author | Roman / Linnea Gräf <roman.graef@gmail.com> | 2022-10-31 11:18:55 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-31 11:18:55 +0100 |
commit | e9c4e044c076250fcde6ddbdea1ea8c7f9cbf43d (patch) | |
tree | 725dbabf4b14d7c3f0b1f6eaf18d00b04675b9a2 | |
parent | 5697b510ee9e397c71439f7960c671e1b7641f34 (diff) | |
download | NotEnoughUpdates-e9c4e044c076250fcde6ddbdea1ea8c7f9cbf43d.tar.gz NotEnoughUpdates-e9c4e044c076250fcde6ddbdea1ea8c7f9cbf43d.tar.bz2 NotEnoughUpdates-e9c4e044c076250fcde6ddbdea1ea8c7f9cbf43d.zip |
Add label to unmerged PRs (#404)
-rw-r--r-- | .github/workflows/infer.yml | 5 | ||||
-rw-r--r-- | .github/workflows/remove-merge-needed-label.yml | 32 |
2 files changed, 35 insertions, 2 deletions
diff --git a/.github/workflows/infer.yml b/.github/workflows/infer.yml index 7a035a42..049b9d3b 100644 --- a/.github/workflows/infer.yml +++ b/.github/workflows/infer.yml @@ -1,12 +1,13 @@ name: Infer on: - - pull_request + - pull_request_target - workflow_dispatch +permissions: {} jobs: inferering: runs-on: ubuntu-latest - + if: "!contains(github.event.head_commit.message, '[no infer]')" steps: - uses: actions/checkout@v3 name: Checkout feature 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 |