Config #19
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Automated PR Workflow | |
on: | |
pull_request: | |
types: [labeled, unlabeled, synchronize, opened, edited, ready_for_review, reopened, unlocked] | |
permissions: | |
contents: write | |
pull-requests: write # 添加此权限以便自动合并PR | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: '3.11' | |
- name: Install flake8 | |
run: pip install flake8 | |
- name: Lint with flake8 | |
run: | | |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
build_and_test: | |
needs: [lint] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: '3.11' | |
- uses: pdm-project/setup-pdm@v3 | |
- name: Install dependencies | |
run: pdm install -d | |
- name: Build | |
run: | | |
eval $(pdm venv activate) | |
make | |
shell: bash | |
automerge: | |
needs: [build_and_test] | |
if: ${{ success() && github.event_name == 'pull_request' && github.event.action != 'closed' }} | |
runs-on: ubuntu-latest | |
steps: | |
- id: automerge | |
name: Automerge on Success | |
uses: "pascalgn/[email protected]" | |
env: | |
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | |
MERGE_LABELS: "" | |
UPDATE_LABELS: "" | |
MERGE_DELETE_BRANCH: true | |
- name: feedback | |
if: ${{ steps.automerge.outputs.mergeResult == 'merged' }} | |
run: | | |
echo "Pull request ${{ steps.automerge.outputs.pullRequestNumber }} merged!" |