Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix reject-pr.yml #8

Merged
merged 1 commit into from
Sep 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .github/workflows/reject-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,16 @@ jobs:
runs-on: ubuntu-latest
steps:
- run: |
set -euo pipefail
echo "event name: $GITHUB_EVENT_NAME"
if [[ "$GITHUB_EVENT_NAME" != "pull_request_target" ]]; then
echo "::error::This action must only be run on 'pull_request_target' events"
exit 1
esac
export GITHUB_TOKEN="$GH_TOKEN_SECRET"
gh pr close "$PR_URL" --comment "$MESSAGE" --reason 'not planned' &&
gh pr lock "$PR_URL" --reason 'resolved'
env:
GITHUB_TOKEN: ${{ github.token }}
PR_URL: ${{ github.event.issue.url }}
PR_URL: ${{ github.event.pull_request.url }}
MESSAGE: Hey @${{ github.actor }}, this pull request should be directed towards `${{ inputs.correct_branch }}`. Please file a new pull request targeting that branch instead.
Loading