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 eab7e90 commit 710f9e6
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions .github/workflows/kube-actions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ on:
- labeled
- synchronize

# FIXME: The global env seems not work.
env:
GH_TOKEN: ${{ secrets.AGENT_TOKEN }}

Expand All @@ -22,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 @@ -37,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 @@ -47,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 @@ -135,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 @@ -147,3 +144,5 @@ jobs:
else
echo "Not ready to merge"
fi
exit 0

0 comments on commit 710f9e6

Please sign in to comment.