Skip to content

Commit 1c90c13

Browse files
authored
fix reapproval
1 parent 8c6af4d commit 1c90c13

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

.github/workflows/auto-update-app-headers.yml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,20 @@ jobs:
7070
env:
7171
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7272
run: |
73+
# Get the PR number for the current branch
7374
PR_NUMBER=$(gh pr list --head "pr-update-app-files" --json number --jq '.[].number')
74-
PR_AUTHOR=$(gh pr view "$PR_NUMBER" --json author --jq '.author.login')
75-
if [ "$PR_AUTHOR" != "github-actions[bot]" ]; then
76-
gh pr review "$PR_NUMBER" --approve
75+
76+
# Check if a PR number was retrieved
77+
if [ -n "$PR_NUMBER" ]; then
78+
# Get the PR author
79+
PR_AUTHOR=$(gh pr view "$PR_NUMBER" --json author --jq '.author.login')
80+
81+
# Approve the PR if it was not created by the bot
82+
if [ "$PR_AUTHOR" != "github-actions[bot]" ]; then
83+
gh pr review "$PR_NUMBER" --approve
84+
else
85+
echo "PR was created by the bot, skipping review."
86+
fi
7787
else
78-
echo "PR was created by the bot, skipping review."
88+
echo "No PR found for the current branch."
89+
fi

0 commit comments

Comments
 (0)