Skip to content

Commit

Permalink
Add remove logic
Browse files Browse the repository at this point in the history
Signed-off-by: kerthcet <[email protected]>
  • Loading branch information
kerthcet committed Jun 24, 2024
1 parent e72da5e commit 244eb21
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions .github/workflows/kube-actions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ on:
- labeled
- synchronize

env:
GH_TOKEN: ${{ secrets.AGENT_TOKEN }}

jobs:
pr-workflow:
runs-on: ubuntu-latest
Expand All @@ -18,8 +21,6 @@ jobs:

- name: Remove lgtm label on new push
if: github.event_name == 'pull_request' && github.event.action == 'synchronize'
env:
GH_TOKEN: ${{ secrets.AGENT_TOKEN }}
run: |
PR_NUMBER=$(jq -r '.issue.number' $GITHUB_EVENT_PATH)
Expand All @@ -33,6 +34,8 @@ jobs:
echo "Removed 'lgtm' label due to new push."
fi
exit 0
- name: Set up Python
uses: actions/setup-python@v4
with:
Expand All @@ -43,8 +46,6 @@ jobs:

- name: Handle PR Comments
if: github.event_name == 'issue_comment' && github.event.action == 'created'
env:
GH_TOKEN: ${{ secrets.AGENT_TOKEN }}
run: |
COMMENT_BODY=$(jq -r '.comment.body' $GITHUB_EVENT_PATH)
PR_NUMBER=$(jq -r '.issue.number' $GITHUB_EVENT_PATH)
Expand Down Expand Up @@ -131,10 +132,10 @@ jobs:
fi
done <<< "$COMMENT_BODY"
exit 0
- name: Merge PR if approved and lgtm
if: github.event_name == 'pull_request' && github.event.action == 'labeled'
env:
GH_TOKEN: ${{ secrets.AGENT_TOKEN }}
run: |
LABELS=$(gh pr view $PR_NUMBER --json labels --jq '.labels[].name')
if [[ "$LABELS" == *"lgtm"* && "$LABELS" == *"approved"* && "$LABELS" != *"do-not-merge/hold"* ]]; then
Expand All @@ -143,3 +144,5 @@ jobs:
else
echo "Not ready to merge"
fi
exit 0

0 comments on commit 244eb21

Please sign in to comment.