-
Notifications
You must be signed in to change notification settings - Fork 1.9k
39 lines (33 loc) · 1.09 KB
/
label-remove-conflict.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
name: Auto Remove "stale" label
on:
pull_request:
branches:
- develop
- '4.*'
jobs:
check-conflict:
runs-on: ubuntu-22.04
permissions:
contents: read
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get PR Detail
id: PR-detail
run: echo "detail=$(gh pr view $PR_URL --json mergeable,url,labels,author)" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_URL: ${{ github.event.pull_request.html_url }}
- name: 'Remove label "stale"'
env:
PR_DETAIL: ${{ steps.PR-detail.outputs.detail }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_URL: ${{ github.event.pull_request.html_url }}
run: |
# MERGEABLE with 'stale' label
if [ "$(echo $PR_DETAIL | jq -r '.mergeable')" == "MERGEABLE" ] && \
[ "$(echo $PR_DETAIL | jq -r '.labels[] | select(.name == "stale")')" != "" ]; then
# remove 'stale' label
gh pr edit $PR_URL --remove-label "stale"
fi