name: PR Automation
concurrency:
group: ${{ github.repository }}-${{ github.event.pull_request.number }}-${{ github.workflow }}
cancel-in-progress: true
on:
pull_request_target:
types: [opened, reopened, synchronize]
permissions:
pull-requests: write
issues: write
contents: write
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: '0'
RUST_BACKTRACE: 1
RUSTFLAGS: '-C debuginfo=line-tables-only'
jobs:
label:
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v6
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
sync-labels: true
validate-title:
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
types: |
fix
feat
docs
style
refactor
perf
test
build
ci
chore
revert
requireScope: false
auto-merge-dependabot:
runs-on: ubuntu-latest
if: github.actor == 'dependabot[bot]' || github.actor == 'app/dependabot'
needs: [label, validate-title]
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v3
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Auto-merge patch updates
if: ${{ steps.metadata.outputs.update-type != 'version-update:semver-major' }}
run: gh pr merge --auto --squash "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}