|
19 | 19 | CARGO_TERM_COLOR: always
|
20 | 20 |
|
21 | 21 | jobs:
|
22 |
| - maybe-expedite: |
| 22 | + check-up-to-dateness: |
23 | 23 | outputs:
|
24 |
| - value: ${{ steps.expedite.outputs.value }} |
25 |
| - |
| 24 | + is-up-to-date: ${{ steps.main.outputs.is-up-to-date }} |
26 | 25 | runs-on: ubuntu-latest
|
27 |
| - |
28 | 26 | steps:
|
29 |
| - - name: Log github refs |
30 |
| - run: | |
31 |
| - echo '```' >> "$GITHUB_STEP_SUMMARY" |
32 |
| - echo 'github.ref: ${{ github.ref }}' >> "$GITHUB_STEP_SUMMARY" |
33 |
| - echo 'github.sha: ${{ github.sha }}' >> "$GITHUB_STEP_SUMMARY" |
34 |
| - echo '```' >> "$GITHUB_STEP_SUMMARY" |
35 |
| -
|
36 |
| - - uses: actions/checkout@v4 |
37 |
| - with: |
38 |
| - fetch-depth: 0 |
39 |
| - |
40 |
| - - name: Check if merging an up-to-date branch |
41 |
| - if: ${{ github.event_name == 'merge_group' }} |
42 |
| - id: expedite |
43 |
| - run: | |
44 |
| - N="$(expr "${{ github.ref }}" : '.*-\([0-9]\+\)-[^-]*$')" |
45 |
| - BASE_SHA="$(gh api /repos/${{ github.repository }}/pulls/"$N" | jq -r '.base.sha')" |
46 |
| - if git diff --quiet ${{ github.event.merge_group.base_sha }} "$BASE_SHA"; then |
47 |
| - echo "value=1" >> "$GITHUB_OUTPUT" |
48 |
| - fi |
49 |
| - env: |
50 |
| - GH_TOKEN: ${{ github.token }} |
| 27 | + - id: main |
| 28 | + uses: trailofbits/check-up-to-dateness@v1 |
51 | 29 |
|
52 | 30 | lint:
|
53 |
| - needs: [maybe-expedite] |
| 31 | + needs: [check-up-to-dateness] |
54 | 32 |
|
55 |
| - if: ${{ ! needs.maybe-expedite.outputs.value }} |
| 33 | + if: needs.check-up-to-dateness.outputs.is-up-to-date != 'true' |
56 | 34 |
|
57 | 35 | runs-on: ubuntu-latest
|
58 | 36 |
|
@@ -90,22 +68,10 @@ jobs:
|
90 | 68 | - name: Prettier
|
91 | 69 | run: npm install -g prettier && prettier --check '**/*.json' '**/*.md' '**/*.yml'
|
92 | 70 |
|
93 |
| - # https://github.com/DevinR528/cargo-sort/issues/57#issuecomment-1457714872 |
94 |
| - - name: Cargo sort |
95 |
| - run: | |
96 |
| - cargo install cargo-sort || true |
97 |
| - find . -name Cargo.toml -print0 | xargs -0 -n 1 dirname | xargs -n 1 cargo sort --check --grouped --no-format |
98 |
| -
|
99 |
| - - name: Format |
100 |
| - run: | |
101 |
| - rustup install nightly |
102 |
| - rustup +nightly component add rustfmt |
103 |
| - cargo +nightly fmt && git diff --exit-code |
104 |
| -
|
105 | 71 | test:
|
106 |
| - needs: [maybe-expedite] |
| 72 | + needs: [check-up-to-dateness] |
107 | 73 |
|
108 |
| - if: ${{ ! needs.maybe-expedite.outputs.value }} |
| 74 | + if: needs.check-up-to-dateness.outputs.is-up-to-date != 'true' |
109 | 75 |
|
110 | 76 | runs-on: ubuntu-latest
|
111 | 77 |
|
@@ -156,12 +122,14 @@ jobs:
|
156 | 122 | run: |
|
157 | 123 | rustup install nightly
|
158 | 124 | rustup +nightly component add clippy
|
| 125 | + rustup +nightly component add rustfmt |
159 | 126 | cargo install cargo-dylint dylint-link || true
|
160 | 127 | cargo install cargo-license || true
|
161 | 128 | cargo install cargo-sort || true
|
162 | 129 | cargo install cargo-supply-chain || true
|
163 | 130 | cargo install cargo-unmaintained || true
|
164 | 131 | cargo install group-runner || true
|
| 132 | + go install github.com/rhysd/actionlint/cmd/actionlint@latest |
165 | 133 |
|
166 | 134 | - name: Free up space
|
167 | 135 | run: |
|
|
0 commit comments