autofix_pr.yml

 1# Generated from xtask::workflows::autofix_pr
 2# Rebuild with `cargo xtask workflows`.
 3name: autofix_pr
 4run-name: 'autofix PR #${{ inputs.pr_number }}'
 5on:
 6  workflow_dispatch:
 7    inputs:
 8      pr_number:
 9        description: pr_number
10        required: true
11        type: string
12jobs:
13  run_autofix:
14    runs-on: namespace-profile-2x4-ubuntu-2404
15    steps:
16    - id: get-app-token
17      name: autofix_pr::run_autofix::authenticate_as_zippy
18      uses: actions/create-github-app-token@bef1eaf1c0ac2b148ee2a0a74c65fbe6db0631f1
19      with:
20        app-id: ${{ secrets.ZED_ZIPPY_APP_ID }}
21        private-key: ${{ secrets.ZED_ZIPPY_APP_PRIVATE_KEY }}
22    - name: steps::checkout_repo_with_token
23      uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
24      with:
25        clean: false
26        token: ${{ steps.get-app-token.outputs.token }}
27    - name: autofix_pr::run_autofix::checkout_pr
28      run: gh pr checkout ${{ inputs.pr_number }}
29      shell: bash -euxo pipefail {0}
30      env:
31        GITHUB_TOKEN: ${{ steps.get-app-token.outputs.token }}
32    - name: autofix_pr::run_autofix::run_cargo_fmt
33      run: cargo fmt --all
34      shell: bash -euxo pipefail {0}
35    - name: autofix_pr::run_autofix::run_clippy_fix
36      run: cargo clippy --workspace --release --all-targets --all-features --fix --allow-dirty --allow-staged
37      shell: bash -euxo pipefail {0}
38    - name: autofix_pr::run_autofix::commit_and_push
39      run: |
40        if git diff --quiet; then
41            echo "No changes to commit"
42        else
43            git add -A
44            git commit -m "Apply cargo fmt and clippy --fix"
45            git push
46        fi
47      shell: bash -euxo pipefail {0}
48      env:
49        GIT_COMMITTER_NAME: Zed Zippy
50        GIT_COMMITTER_EMAIL: hi@zed.dev
51        GIT_AUTHOR_NAME: Zed Zippy
52        GIT_AUTHOR_EMAIL: hi@zed.dev
53        GITHUB_TOKEN: ${{ steps.get-app-token.outputs.token }}