39 lines
1.2 KiB
YAML
39 lines
1.2 KiB
YAML
name: Review Pull Request
|
|
|
|
on:
|
|
pull_request_target:
|
|
types: [opened, reopened]
|
|
|
|
env:
|
|
EXPECTED_BRANCH: "MAKE-PRS-HERE"
|
|
GIT_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
permissions:
|
|
pull-requests: write
|
|
|
|
jobs:
|
|
pr_check:
|
|
runs-on: ubuntu-latest
|
|
if: ${{ github.actor != 'FrogAi' }}
|
|
steps:
|
|
- name: Validate Target Branch
|
|
env:
|
|
GH_TOKEN: ${{ env.GIT_TOKEN }}
|
|
PR_NUMBER: ${{ github.event.pull_request.number }}
|
|
REPO: ${{ github.repository }}
|
|
TARGET_BRANCH: ${{ github.base_ref }}
|
|
run: |
|
|
if [ "$TARGET_BRANCH" != "$EXPECTED_BRANCH" ]; then
|
|
echo "Invalid target branch: $TARGET_BRANCH"
|
|
|
|
gh pr comment "$PR_NUMBER" --repo "$REPO" \
|
|
--body "Please submit your pull request to the \"$EXPECTED_BRANCH\" branch."
|
|
|
|
gh pr close "$PR_NUMBER" --repo "$REPO"
|
|
else
|
|
echo "Valid target branch."
|
|
|
|
gh pr comment "$PR_NUMBER" --repo "$REPO" \
|
|
--body "Thank you for your PR! If you're not already in the FrogPilot Discord, [feel free to join](https://discord.FrogPilot.com) and let me know you've opened a PR!"
|
|
fi
|