Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
totoprayogo1916 committed Sep 19, 2023
1 parent 2189897 commit 7213379
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 16 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/label-add-conflict.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ on:
branches:
- develop
- '4.*'
pull_request:
branches:
- develop
- '4.*'

jobs:
auto-label-comment-conflict:
Expand All @@ -15,9 +19,12 @@ jobs:

runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Get PR List
id: PR-list
run: echo "pr_list=$(gh pr list -L 100 --json mergeable,url,labels,author)" >> $GITHUB_OUTPUT
run: echo "pr_list=$(gh pr list -L 100 --json mergeable,url,labels,author,statusCheckRollup)" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand Down
20 changes: 5 additions & 15 deletions .github/workflows/label-remove-conflict.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,9 @@ jobs:
env:
PR_DETAIL: ${{ steps.PR-detail.outputs.detail }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_URL: ${{ github.event.pull_request.html_url }}
run: |
IFS=$'\n' # Set Internal Field Separator to newline to handle array elements
# Iterate through the PRs in PR_DETAIL
for pr in $(echo "$PR_DETAIL" | jq -c '.[]'); do
mergeable=$(echo "$pr" | jq -r '.mergeable')
author=$(echo "$pr" | jq -r '.author.login')
labels=$(echo "$pr" | jq -c '.labels[].name' | tr -d '[]"')
url=$(echo "$pr" | jq -r '.url')
if [ "$mergeable" == "MERGEABLE" ] && [[ "$labels" == *"stale"* ]]; then
# Remove "stale" label
gh pr edit $url --add-label "stale"
fi
done
if [ "$(echo $PR_DETAIL | jq -r '.mergeable')" == "MERGEABLE" ] && \
[ "$(echo $PR_DETAIL | jq -r '.labels[] | select(.name == "stale")')" != "" ]; then
gh pr edit $PR_URL --remove-label "stale"
fi

0 comments on commit 7213379

Please sign in to comment.