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-16x32-ubuntu-2204
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: steps::setup_cargo_config
33 run: |
34 mkdir -p ./../.cargo
35 cp ./.cargo/ci-config.toml ./../.cargo/config.toml
36 shell: bash -euxo pipefail {0}
37 - name: steps::cache_rust_dependencies_namespace
38 uses: namespacelabs/nscloud-cache-action@v1
39 with:
40 cache: rust
41 - name: steps::setup_linux
42 run: ./script/linux
43 shell: bash -euxo pipefail {0}
44 - name: steps::install_mold
45 run: ./script/install-mold
46 shell: bash -euxo pipefail {0}
47 - name: steps::download_wasi_sdk
48 run: ./script/download-wasi-sdk
49 shell: bash -euxo pipefail {0}
50 - name: steps::setup_pnpm
51 uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2
52 with:
53 version: '9'
54 - name: autofix_pr::run_autofix::run_prettier_fix
55 run: ./script/prettier --write
56 shell: bash -euxo pipefail {0}
57 - name: autofix_pr::run_autofix::run_cargo_fmt
58 run: cargo fmt --all
59 shell: bash -euxo pipefail {0}
60 - name: autofix_pr::run_autofix::run_clippy_fix
61 run: cargo clippy --workspace --release --all-targets --all-features --fix --allow-dirty --allow-staged
62 shell: bash -euxo pipefail {0}
63 - name: autofix_pr::run_autofix::commit_and_push
64 run: |
65 if git diff --quiet; then
66 echo "No changes to commit"
67 else
68 git add -A
69 git commit -m "Autofix"
70 git push
71 fi
72 shell: bash -euxo pipefail {0}
73 env:
74 GIT_COMMITTER_NAME: Zed Zippy
75 GIT_COMMITTER_EMAIL: 234243425+zed-zippy[bot]@users.noreply.github.com
76 GIT_AUTHOR_NAME: Zed Zippy
77 GIT_AUTHOR_EMAIL: 234243425+zed-zippy[bot]@users.noreply.github.com
78 GITHUB_TOKEN: ${{ steps.get-app-token.outputs.token }}
79 - name: steps::cleanup_cargo_config
80 if: always()
81 run: |
82 rm -rf ./../.cargo
83 shell: bash -euxo pipefail {0}