Skip to content

Commit

Permalink
remove lgtm when new push
Browse files Browse the repository at this point in the history
Signed-off-by: kerthcet <[email protected]>
  • Loading branch information
kerthcet committed Jun 23, 2024
1 parent 8b730d7 commit e49beb9
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/kube-actions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
types: [created]
pull_request:
types: [labeled]
push:
branches:
- '**'

env:
GH_TOKEN: ${{ secrets.AGENT_TOKEN }}
Expand All @@ -17,6 +20,22 @@ jobs:
- name: Checkout code
uses: actions/checkout@v2

- name: Remove lgtm label on new push
if: github.event_name == 'push'
run: |
PR_NUMBER=$(jq -r '.issue.number' $GITHUB_EVENT_PATH)
if [ -z "$PR_NUMBER" ]; then
echo "No PR number found in push event context."
exit 0
fi
if gh pr view $PR_NUMBER --json labels --jq '.labels[].name' | grep -q "lgtm"; then
gh pr edit $pr --remove-label lgtm
echo "Removed 'lgtm' label due to new push."
fi
exit 0
- name: Set up Python
uses: actions/setup-python@v4
with:
Expand Down Expand Up @@ -116,6 +135,7 @@ jobs:
LABELS=$(gh pr view $PR_NUMBER --json labels --jq '.labels[].name')
if [[ "$LABELS" == *"lgtm"* && "$LABELS" == *"approved"* && "$LABELS" != *"do-not-merge/hold"* ]]; then
gh pr merge $PR_NUMBER --merge
echo "Merge!"
else
echo "Not ready to merge"
fi

0 comments on commit e49beb9

Please sign in to comment.