Skip to content

Commit f4cdd2d

Browse files
authored
CI: Harden CI (#2091)
1 parent df1773d commit f4cdd2d

File tree

4 files changed

+85
-61
lines changed

4 files changed

+85
-61
lines changed

.github/dependabot.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,13 @@ updates:
1212
dependency-type: production
1313
dev-dependencies:
1414
dependency-type: development
15+
- package-ecosystem: "github-actions"
16+
directory: "/"
17+
schedule:
18+
interval: "weekly"
19+
groups:
20+
# Group all GitHub Actions updates together to have less PRs
21+
github-actions:
22+
applies-to: version-updates
23+
patterns:
24+
- "*"

.github/workflows/ash-ci.yml

Lines changed: 56 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ on:
5757
env:
5858
PG_VERSION: ${{inputs.postgres-version}}
5959
ASH_CI_BUILD: true
60+
permissions:
61+
contents: read
6062
jobs:
6163
# Some kind of 403 permissions bug here
6264
report_mix_deps:
@@ -65,16 +67,16 @@ jobs:
6567
# Only run this job when we're on the main branch, not for PRs
6668
if: github.ref == 'refs/heads/main'
6769
steps:
68-
- uses: actions/checkout@v4
69-
- uses: erlef/mix-dependency-submission@v1
70+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
71+
- uses: erlef/mix-dependency-submission@dd81a2f0238bd242a4674703ba7b99c0b284b2f1 # v1.1.3
7072
permissions:
7173
# Give the default GITHUB_TOKEN write permission to call the dependencies API
7274
contents: write
7375
auditor:
7476
name: audit
7577
runs-on: ubuntu-latest
7678
steps:
77-
- uses: actions/checkout@v3
79+
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
7880
- name: Update Elixir version in .tool-versions
7981
if: inputs.elixir-version != 'default'
8082
run: |
@@ -99,15 +101,15 @@ jobs:
99101
else
100102
echo "erlang ${{ inputs.erlang-version }}" > .tool-versions
101103
fi
102-
- uses: team-alembic/staple-actions/actions/mix-hex-audit@main
103-
- uses: team-alembic/staple-actions/actions/mix-task@main
104+
- uses: team-alembic/staple-actions/actions/mix-hex-audit@59199173e18eee6748b65d01626ef82d51c6e963 # main
105+
- uses: team-alembic/staple-actions/actions/mix-task@59199173e18eee6748b65d01626ef82d51c6e963 # main
104106
with:
105107
task: deps.audit
106108
build-test:
107109
name: MIX_ENV=test mix.compile
108110
runs-on: ubuntu-latest
109111
steps:
110-
- uses: actions/checkout@v3
112+
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
111113
- name: Update Elixir version in .tool-versions
112114
if: inputs.elixir-version != 'default'
113115
run: |
@@ -132,8 +134,8 @@ jobs:
132134
else
133135
echo "erlang ${{ inputs.erlang-version }}" > .tool-versions
134136
fi
135-
- uses: team-alembic/staple-actions/actions/install-elixir@main
136-
- uses: team-alembic/staple-actions/actions/mix-compile@main
137+
- uses: team-alembic/staple-actions/actions/install-elixir@59199173e18eee6748b65d01626ef82d51c6e963 # main
138+
- uses: team-alembic/staple-actions/actions/mix-compile@59199173e18eee6748b65d01626ef82d51c6e963 # main
137139
with:
138140
mix-env: test
139141
build-docs:
@@ -144,12 +146,12 @@ jobs:
144146
- build-test
145147
- spark-cheat-sheets
146148
steps:
147-
- uses: actions/checkout@v3
148-
- uses: team-alembic/staple-actions/actions/mix-docs@main
149+
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
150+
- uses: team-alembic/staple-actions/actions/mix-docs@59199173e18eee6748b65d01626ef82d51c6e963 # main
149151
with:
150152
mix-env: dev
151153
use-cache: false
152-
- uses: actions/upload-pages-artifact@v3
154+
- uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1
153155
with:
154156
path: doc/
155157
deploy-docs:
@@ -168,16 +170,16 @@ jobs:
168170
steps:
169171
- name: Deploy to GitHub pages
170172
id: deployment
171-
uses: actions/deploy-pages@v4
173+
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5
172174

173175
formatter:
174176
name: mix format --check-formatted
175177
runs-on: ubuntu-latest
176178
needs:
177179
- build-test
178180
steps:
179-
- uses: actions/checkout@v3
180-
- uses: team-alembic/staple-actions/actions/mix-format@main
181+
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
182+
- uses: team-alembic/staple-actions/actions/mix-format@59199173e18eee6748b65d01626ef82d51c6e963 # main
181183
with:
182184
mix-env: test
183185

@@ -187,8 +189,8 @@ jobs:
187189
needs:
188190
- build-test
189191
steps:
190-
- uses: actions/checkout@v3
191-
- uses: team-alembic/staple-actions/actions/mix-task@main
192+
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
193+
- uses: team-alembic/staple-actions/actions/mix-task@59199173e18eee6748b65d01626ef82d51c6e963 # main
192194
if: ${{inputs.spark-formatter}}
193195
with:
194196
mix-env: test
@@ -200,13 +202,13 @@ jobs:
200202
needs:
201203
- build-test
202204
steps:
203-
- uses: actions/checkout@v3
204-
- uses: team-alembic/staple-actions/actions/mix-task@main
205+
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
206+
- uses: team-alembic/staple-actions/actions/mix-task@59199173e18eee6748b65d01626ef82d51c6e963 # main
205207
if: ${{inputs.spark-cheat-sheets}}
206208
with:
207209
mix-env: test
208210
task: spark.cheat_sheets --dry-run --yes
209-
- uses: team-alembic/staple-actions/actions/mix-task@main
211+
- uses: team-alembic/staple-actions/actions/mix-task@59199173e18eee6748b65d01626ef82d51c6e963 # main
210212
if: ${{inputs.spark-cheat-sheets}}
211213
with:
212214
mix-env: test
@@ -217,8 +219,8 @@ jobs:
217219
needs:
218220
- build-test
219221
steps:
220-
- uses: actions/checkout@v3
221-
- uses: team-alembic/staple-actions/actions/mix-task@main
222+
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
223+
- uses: team-alembic/staple-actions/actions/mix-task@59199173e18eee6748b65d01626ef82d51c6e963 # main
222224
if: ${{inputs.sobelow}}
223225
with:
224226
mix-env: test
@@ -230,8 +232,8 @@ jobs:
230232
permissions:
231233
security-events: write
232234
steps:
233-
- uses: actions/checkout@v3
234-
- uses: team-alembic/staple-actions/actions/mix-credo@main
235+
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
236+
- uses: team-alembic/staple-actions/actions/mix-credo@59199173e18eee6748b65d01626ef82d51c6e963 # main
235237
if: ${{inputs.spark-formatter}}
236238
with:
237239
mix-env: test
@@ -251,8 +253,8 @@ jobs:
251253
- build-test
252254
if: ${{inputs.codegen}}
253255
steps:
254-
- uses: actions/checkout@v3
255-
- uses: team-alembic/staple-actions/actions/mix-task@main
256+
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
257+
- uses: team-alembic/staple-actions/actions/mix-task@59199173e18eee6748b65d01626ef82d51c6e963 # main
256258
with:
257259
mix-env: test
258260
task: ash.codegen --check
@@ -262,8 +264,8 @@ jobs:
262264
needs:
263265
- build-test
264266
steps:
265-
- uses: actions/checkout@v3
266-
- uses: team-alembic/staple-actions/actions/mix-task@main
267+
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
268+
- uses: team-alembic/staple-actions/actions/mix-task@59199173e18eee6748b65d01626ef82d51c6e963 # main
267269
with:
268270
mix-env: test
269271
task: deps.unlock --check-unused
@@ -278,19 +280,19 @@ jobs:
278280
steps:
279281
- name: Dependabot metadata
280282
id: dependabot-metadata
281-
uses: dependabot/fetch-metadata@v2
283+
uses: dependabot/fetch-metadata@08eff52bf64351f401fb50d4972fa95b9f2c2d1b # v2.4.0
282284
if: github.event.pull_request.user.login == 'dependabot[bot]'
283-
- uses: actions/checkout@v3
285+
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
284286
with:
285287
fetch-depth: 0
286288
ref: ${{ github.head_ref }}
287289
if: github.event.pull_request.user.login == 'dependabot[bot]'
288-
- uses: team-alembic/staple-actions/actions/mix-task@main
290+
- uses: team-alembic/staple-actions/actions/mix-task@59199173e18eee6748b65d01626ef82d51c6e963 # main
289291
with:
290292
task: igniter.upgrade --git-ci --yes
291293
if: github.event.pull_request.user.login == 'dependabot[bot]'
292294
- name: Commit Changes
293-
uses: stefanzweifel/git-auto-commit-action@v5
295+
uses: stefanzweifel/git-auto-commit-action@b863ae1933cb653a53c021fe36dbb774e1fb9403 # v5.2.0
294296
if: github.event.pull_request.user.login == 'dependabot[bot]'
295297
with:
296298
commit_message: "[dependabot skip] Apply Igniter Upgrades"
@@ -315,53 +317,53 @@ jobs:
315317
ports:
316318
- 5432:5432
317319
steps:
318-
- uses: actions/checkout@v3
319-
- uses: team-alembic/staple-actions/actions/mix-task@main
320+
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
321+
- uses: team-alembic/staple-actions/actions/mix-task@59199173e18eee6748b65d01626ef82d51c6e963 # main
320322
if: ${{inputs.postgres && inputs.ash_postgres}}
321323
with:
322324
mix-env: test
323325
task: ash_postgres.generate_migrations --check
324-
- uses: team-alembic/staple-actions/actions/mix-task@main
326+
- uses: team-alembic/staple-actions/actions/mix-task@59199173e18eee6748b65d01626ef82d51c6e963 # main
325327
with:
326328
mix-env: test
327329
task: ash_postgres.create
328330
if: ${{inputs.postgres && inputs.ash_postgres}}
329-
- uses: team-alembic/staple-actions/actions/mix-task@main
331+
- uses: team-alembic/staple-actions/actions/mix-task@59199173e18eee6748b65d01626ef82d51c6e963 # main
330332
with:
331333
mix-env: test
332334
task: ecto.create
333335
if: ${{inputs.postgres && inputs.ecto_postgres}}
334-
- uses: team-alembic/staple-actions/actions/mix-task@main
336+
- uses: team-alembic/staple-actions/actions/mix-task@59199173e18eee6748b65d01626ef82d51c6e963 # main
335337
with:
336338
mix-env: test
337339
task: ash_postgres.migrate
338340
if: ${{inputs.postgres && inputs.ash_postgres}}
339-
- uses: team-alembic/staple-actions/actions/mix-task@main
341+
- uses: team-alembic/staple-actions/actions/mix-task@59199173e18eee6748b65d01626ef82d51c6e963 # main
340342
with:
341343
mix-env: test
342344
task: ash_postgres.migrate --tenants
343345
if: ${{inputs.postgres && inputs.ash_postgres}}
344-
- uses: team-alembic/staple-actions/actions/mix-task@main
346+
- uses: team-alembic/staple-actions/actions/mix-task@59199173e18eee6748b65d01626ef82d51c6e963 # main
345347
with:
346348
mix-env: test
347349
task: ecto.migrate
348350
if: ${{inputs.postgres && inputs.ecto_postgres}}
349-
- uses: team-alembic/staple-actions/actions/mix-task@main
351+
- uses: team-alembic/staple-actions/actions/mix-task@59199173e18eee6748b65d01626ef82d51c6e963 # main
350352
with:
351353
mix-env: test
352354
task: ash_sqlite.generate_migrations --check
353355
if: ${{inputs.sqlite}}
354-
- uses: team-alembic/staple-actions/actions/mix-task@main
356+
- uses: team-alembic/staple-actions/actions/mix-task@59199173e18eee6748b65d01626ef82d51c6e963 # main
355357
with:
356358
mix-env: test
357359
task: ash_sqlite.create
358360
if: ${{inputs.sqlite}}
359-
- uses: team-alembic/staple-actions/actions/mix-task@main
361+
- uses: team-alembic/staple-actions/actions/mix-task@59199173e18eee6748b65d01626ef82d51c6e963 # main
360362
with:
361363
mix-env: test
362364
task: ash_sqlite.migrate
363365
if: ${{inputs.sqlite}}
364-
- uses: team-alembic/staple-actions/actions/mix-test@main
366+
- uses: team-alembic/staple-actions/actions/mix-test@59199173e18eee6748b65d01626ef82d51c6e963 # main
365367
with:
366368
mix-env: test
367369
env:
@@ -375,8 +377,8 @@ jobs:
375377
needs:
376378
- build-test
377379
steps:
378-
- uses: actions/checkout@v3
379-
- uses: team-alembic/staple-actions/actions/mix-dialyzer@main
380+
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
381+
- uses: team-alembic/staple-actions/actions/mix-dialyzer@59199173e18eee6748b65d01626ef82d51c6e963 # main
380382
with:
381383
mix-env: dev
382384

@@ -386,8 +388,8 @@ jobs:
386388
needs:
387389
- build-test
388390
steps:
389-
- uses: actions/checkout@v3
390-
- uses: team-alembic/staple-actions/actions/mix-compile@main
391+
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
392+
- uses: team-alembic/staple-actions/actions/mix-compile@59199173e18eee6748b65d01626ef82d51c6e963 # main
391393
with:
392394
mix-env: dev
393395
build-release:
@@ -456,7 +458,7 @@ jobs:
456458

457459
steps:
458460
- name: Checkout source code
459-
uses: actions/checkout@v4
461+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
460462

461463
- name: Extract crate information
462464
shell: bash
@@ -467,15 +469,15 @@ jobs:
467469
shell: bash
468470
run: |
469471
rustup target add ${{ matrix.job.target }}
470-
- uses: Swatinem/rust-cache@v2
472+
- uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 # v2.7.8
471473
with:
472474
prefix-key: v0-precomp
473475
shared-key: ${{ matrix.job.target }}-${{ matrix.nif }}
474476
workspaces: |
475477
native/igniter_js
476478
- name: Build the project
477479
id: build-crate
478-
uses: philss/rustler-precompiled-action@v1.1.4
480+
uses: philss/rustler-precompiled-action@853ac56183f29a080304df3ff8a194b5bbdc24cc # v1.1.4
479481
with:
480482
project-name: igniter_js
481483
project-version: ${{ env.PROJECT_VERSION }}
@@ -487,13 +489,13 @@ jobs:
487489
cargo-args: ${{ matrix.job.cargo-args }}
488490

489491
- name: Artifact upload
490-
uses: actions/upload-artifact@v4
492+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
491493
with:
492494
name: ${{ steps.build-crate.outputs.file-name }}
493495
path: ${{ steps.build-crate.outputs.file-path }}
494496

495497
- name: Publish archives and packages
496-
uses: softprops/action-gh-release@v2
498+
uses: softprops/action-gh-release@da05d552573ad5aba039eaac05058a918a7bf631 # v2.2.2
497499
with:
498500
files: |
499501
${{ steps.build-crate.outputs.file-path }}
@@ -516,12 +518,12 @@ jobs:
516518
runs-on: ubuntu-latest
517519
name: Release
518520
steps:
519-
- uses: actions/checkout@v3
520-
- uses: team-alembic/staple-actions/actions/mix-task@main
521+
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
522+
- uses: team-alembic/staple-actions/actions/mix-task@59199173e18eee6748b65d01626ef82d51c6e963 # main
521523
if: ${{inputs.rustler-precompiled-module}}
522524
with:
523525
task: rustler_precompiled.download ${{inputs.rustler-precompiled-module}} --only-local --all --print
524-
- uses: team-alembic/staple-actions/actions/mix-hex-publish@main
526+
- uses: team-alembic/staple-actions/actions/mix-hex-publish@59199173e18eee6748b65d01626ef82d51c6e963 # main
525527
with:
526528
mix-env: dev
527529
hex-api-key: ${{secrets.HEX_API_KEY}}

.github/workflows/ci.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,20 @@ on:
77
pull_request:
88
branches: [main, "3.0"]
99
workflow_dispatch:
10-
10+
permissions:
11+
contents: read
1112
jobs:
1213
ash-ci:
1314
strategy:
1415
matrix:
1516
sat_solver: ["SimpleSat", "Picosat"]
16-
uses: ash-project/ash/.github/workflows/ash-ci.yml@main
17+
uses: ./.github/workflows/ash-ci.yml
1718
secrets:
1819
HEX_API_KEY: ${{ secrets.HEX_API_KEY }}
20+
permissions:
21+
contents: write
22+
pages: write
23+
id-token: write
1924
with:
2025
sat-solver: ${{ matrix.sat_solver }}
2126
igniter-upgrade: ${{matrix.sat_solver == 'Picosat'}}

0 commit comments

Comments
 (0)