mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-12-02 13:35:15 +08:00
45 lines
1.5 KiB
YAML
45 lines
1.5 KiB
YAML
name: "PR review"
|
|
on:
|
|
pull_request_target:
|
|
types: [opened, reopened, synchronize, edited]
|
|
|
|
jobs:
|
|
labeler:
|
|
name: review
|
|
permissions:
|
|
contents: read
|
|
pull-requests: write
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Close pull requests targeting testing
|
|
if: github.repository == 'StarPilotHQ/StarPilot' && github.event.pull_request.base.ref == 'testing'
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
PR_NUMBER: ${{ github.event.pull_request.number }}
|
|
run: |
|
|
current=$(gh pr view "$PR_NUMBER" --repo "$GITHUB_REPOSITORY" --json baseRefName,state --jq '.baseRefName + ":" + .state')
|
|
if [ "$current" = testing:OPEN ]; then
|
|
gh pr close "$PR_NUMBER" --repo "$GITHUB_REPOSITORY" --comment 'Please retarget this pull request to `stable` and reopen it. Maintainers publish qualified changes to `testing`.'
|
|
fi
|
|
|
|
- uses: actions/checkout@v7
|
|
|
|
# Label PRs
|
|
- uses: actions/labeler@v6
|
|
with:
|
|
dot: true
|
|
configuration-path: .github/labeler.yaml
|
|
|
|
# Check PR target branch
|
|
- name: check branch
|
|
uses: Vankka/pr-target-branch-action@5da68a42bcb7b43d39104295a876a6f3f8d7908b
|
|
if: github.repository == 'commaai/openpilot'
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
target: /^(?!master$).*/
|
|
exclude: /commaai:.*/
|
|
change-to: ${{ github.base_ref }}
|
|
already-exists-action: close_this
|
|
already-exists-comment: "Your PR should be made against the `master` branch"
|