Skip to content

Commit a32deca

Browse files
refactor(ci): apply security best practices (#1180)
* [StepSecurity] Apply security best practices Signed-off-by: StepSecurity Bot <[email protected]> * switch daily to monthly, add groups and pull request limit to new npm ecosystem. I don't think docker group support update types but I can test it and get back to you but on the GitHub documentation it's not listed as supported under group types * format: pre-order list so npm is under the same header. add comment about docker depends makes it in line with previous. formatting fix * format: remove blank line * [StepSecurity] ci: Harden GitHub Actions Signed-off-by: StepSecurity Bot <[email protected]> --------- Signed-off-by: StepSecurity Bot <[email protected]> Co-authored-by: StepSecurity Bot <[email protected]>
1 parent c156fc5 commit a32deca

File tree

10 files changed

+199
-84
lines changed

10 files changed

+199
-84
lines changed

.github/dependabot.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,23 @@ updates:
4141
patch:
4242
update-types:
4343
- "patch"
44+
45+
- package-ecosystem: npm
46+
directory: /npm/git-cliff
47+
schedule:
48+
interval: monthly
49+
open-pull-requests-limit: 10
50+
groups:
51+
minor:
52+
update-types:
53+
- "minor"
54+
patch:
55+
update-types:
56+
- "patch"
57+
58+
# Maintain dependencies for Docker
59+
- package-ecosystem: docker
60+
directory: /
61+
schedule:
62+
interval: monthly
63+
open-pull-requests-limit: 10

.github/workflows/cd.yml

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ jobs:
1313
release_body: ${{ steps.git-cliff.outputs.content }}
1414
steps:
1515
- name: Checkout
16-
uses: actions/checkout@v4
16+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1717
with:
1818
fetch-depth: 0
1919
- name: Generate a changelog
20-
uses: orhun/git-cliff-action@main
20+
uses: orhun/git-cliff-action@104a6cf3c9aa0fdfe4eab129f9c1900e1eb8f7fd # main
2121
id: git-cliff
2222
with:
2323
config: cliff.toml
@@ -129,7 +129,7 @@ jobs:
129129
}
130130
steps:
131131
- name: Checkout
132-
uses: actions/checkout@v4
132+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
133133
- name: Set the release version
134134
shell: bash
135135
run: echo "RELEASE_VERSION=${GITHUB_REF:11}" >> $GITHUB_ENV
@@ -142,21 +142,21 @@ jobs:
142142
--allow-unauthenticated musl-tools
143143
fi
144144
- name: Install Rust toolchain
145-
uses: actions-rs/toolchain@v1
145+
uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7
146146
with:
147147
toolchain: ${{ matrix.build.TOOLCHAIN }}
148148
target: ${{ matrix.build.TARGET }}
149149
override: true
150150
- name: Build (linux/macos)
151151
if: matrix.build.OS != 'windows-2022'
152-
uses: actions-rs/cargo@v1
152+
uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1.0.3
153153
with:
154154
use-cross: true
155155
command: build
156156
args: --release --locked --target ${{ matrix.build.TARGET }}
157157
- name: Build (windows)
158158
if: matrix.build.OS == 'windows-2022'
159-
uses: actions-rs/cargo@v1
159+
uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1.0.3
160160
with:
161161
command: build
162162
args: --release --locked --target ${{ matrix.build.TARGET }} # --no-default-features
@@ -197,7 +197,7 @@ jobs:
197197
git-cliff-${{ env.RELEASE_VERSION }}-${{ matrix.build.TARGET }}.tar.gz
198198
- name: Publish to GitHub
199199
if: ${{ !contains(github.ref, '-') }}
200-
uses: svenstaro/upload-release-action@v2
200+
uses: svenstaro/upload-release-action@04733e069f2d7f7f0b4aebc4fbdbce8613b03ccd # v2
201201
with:
202202
repo_token: ${{ secrets.GITHUB_TOKEN }}
203203
file: git-cliff-${{ env.RELEASE_VERSION }}-${{ matrix.build.TARGET }}*
@@ -208,7 +208,7 @@ jobs:
208208
body: "${{ needs.generate-changelog.outputs.release_body }}"
209209
- name: Publish to GitHub (pre-release)
210210
if: ${{ contains(github.ref, '-') }}
211-
uses: svenstaro/upload-release-action@v2
211+
uses: svenstaro/upload-release-action@04733e069f2d7f7f0b4aebc4fbdbce8613b03ccd # v2
212212
with:
213213
repo_token: ${{ secrets.GITHUB_TOKEN }}
214214
file: git-cliff-${{ env.RELEASE_VERSION }}-${{ matrix.build.TARGET }}*
@@ -219,7 +219,7 @@ jobs:
219219
prerelease: true
220220
- name: Install node
221221
if: matrix.build.NPM_PUBLISH == true
222-
uses: actions/setup-node@v4
222+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
223223
with:
224224
node-version: 18
225225
registry-url: "https://registry.npmjs.org"
@@ -252,7 +252,7 @@ jobs:
252252
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
253253
- name: Build Python wheels (linux)
254254
if: matrix.build.PYPI_PUBLISH == true && startsWith(matrix.build.NAME, 'linux')
255-
uses: PyO3/maturin-action@v1
255+
uses: PyO3/maturin-action@35be3186fc8e037e329f06b68dcd807d83dcc6dc # v1.49.2
256256
with:
257257
working-directory: pypi
258258
target: ${{ matrix.build.TARGET }}
@@ -264,23 +264,23 @@ jobs:
264264
if: |
265265
matrix.build.PYPI_PUBLISH == true &&
266266
(startsWith(matrix.build.OS, 'macos') || startsWith(matrix.build.OS, 'windows'))
267-
uses: PyO3/maturin-action@v1
267+
uses: PyO3/maturin-action@35be3186fc8e037e329f06b68dcd807d83dcc6dc # v1.49.2
268268
with:
269269
working-directory: pypi
270270
target: ${{ matrix.build.TARGET }}
271271
args: --release --sdist --out wheels
272272
sccache: "true"
273273
- name: Build Python wheels (musl)
274274
if: matrix.build.PYPI_PUBLISH == true && endsWith(matrix.build.OS, 'musl')
275-
uses: PyO3/maturin-action@v1
275+
uses: PyO3/maturin-action@35be3186fc8e037e329f06b68dcd807d83dcc6dc # v1.49.2
276276
with:
277277
working-directory: pypi
278278
target: ${{ matrix.build.TARGET }}
279279
args: --release --sdist --out wheels
280280
sccache: "true"
281281
manylinux: musllinux_1_2
282282
- name: Upload Python wheels
283-
uses: actions/upload-artifact@v4
283+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
284284
with:
285285
name: "wheels-${{ matrix.build.TARGET }}"
286286
working-directory: pypi
@@ -292,9 +292,9 @@ jobs:
292292
runs-on: ubuntu-22.04
293293
steps:
294294
- name: Checkout
295-
uses: actions/checkout@v4
295+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
296296
- name: Install node
297-
uses: actions/setup-node@v4
297+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
298298
with:
299299
node-version: 18
300300
registry-url: "https://registry.npmjs.org"
@@ -322,13 +322,13 @@ jobs:
322322
runs-on: ubuntu-22.04
323323
needs: publish-binaries
324324
steps:
325-
- uses: actions/download-artifact@v4
325+
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
326326
with:
327327
path: pypi/wheels
328328
pattern: wheels-*
329329
merge-multiple: true
330330
- name: Publish to PyPI
331-
uses: PyO3/maturin-action@v1
331+
uses: PyO3/maturin-action@35be3186fc8e037e329f06b68dcd807d83dcc6dc # v1.49.2
332332
env:
333333
MATURIN_PYPI_TOKEN: ${{ vars.USE_TESTPYPI == 'true' && secrets.TESTPYPI_API_TOKEN || secrets.PYPI_API_TOKEN }}
334334
MATURIN_REPOSITORY: ${{ vars.USE_TESTPYPI == 'true' && 'testpypi' || 'pypi' }}
@@ -342,12 +342,12 @@ jobs:
342342
runs-on: ubuntu-22.04
343343
steps:
344344
- name: Checkout
345-
uses: actions/checkout@v4
345+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
346346
- name: Set the release version
347347
shell: bash
348348
run: echo "RELEASE_VERSION=${GITHUB_REF:11}" >> $GITHUB_ENV
349349
- name: Install Rust toolchain
350-
uses: dtolnay/rust-toolchain@stable
350+
uses: dtolnay/rust-toolchain@4305c38b25d97ef35a8ad1f985ccf2d2242004f2 # stable
351351
with:
352352
targets: x86_64-unknown-linux-gnu
353353
- name: Install cargo-deb
@@ -372,7 +372,7 @@ jobs:
372372
git-cliff-${{ env.RELEASE_VERSION }}.deb
373373
- name: Upload the release
374374
if: ${{ !contains(github.ref, '-') }}
375-
uses: svenstaro/upload-release-action@v2
375+
uses: svenstaro/upload-release-action@04733e069f2d7f7f0b4aebc4fbdbce8613b03ccd # v2
376376
with:
377377
repo_token: ${{ secrets.GITHUB_TOKEN }}
378378
file: git-cliff-${{ env.RELEASE_VERSION }}.deb
@@ -381,7 +381,7 @@ jobs:
381381
body: "${{ needs.generate-changelog.outputs.release_body }}"
382382
- name: Upload the pre-release
383383
if: ${{ contains(github.ref, '-') }}
384-
uses: svenstaro/upload-release-action@v2
384+
uses: svenstaro/upload-release-action@04733e069f2d7f7f0b4aebc4fbdbce8613b03ccd # v2
385385
with:
386386
repo_token: ${{ secrets.GITHUB_TOKEN }}
387387
file: git-cliff-${{ env.RELEASE_VERSION }}.deb
@@ -395,12 +395,12 @@ jobs:
395395
runs-on: ubuntu-22.04
396396
steps:
397397
- name: Checkout
398-
uses: actions/checkout@v4
398+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
399399
- name: Set the release version
400400
shell: bash
401401
run: echo "RELEASE_VERSION=${GITHUB_REF:11}" >> $GITHUB_ENV
402402
- name: Install Rust toolchain
403-
uses: dtolnay/rust-toolchain@stable
403+
uses: dtolnay/rust-toolchain@4305c38b25d97ef35a8ad1f985ccf2d2242004f2 # stable
404404
with:
405405
targets: x86_64-unknown-linux-gnu
406406
- name: Install cargo-generate-rpm
@@ -423,7 +423,7 @@ jobs:
423423
git-cliff-${{ env.RELEASE_VERSION }}.x86_64.rpm
424424
- name: Upload the release
425425
if: ${{ !contains(github.ref, '-') }}
426-
uses: svenstaro/upload-release-action@v2
426+
uses: svenstaro/upload-release-action@04733e069f2d7f7f0b4aebc4fbdbce8613b03ccd # v2
427427
with:
428428
repo_token: ${{ secrets.GITHUB_TOKEN }}
429429
file: git-cliff-${{ env.RELEASE_VERSION }}.x86_64.rpm
@@ -432,7 +432,7 @@ jobs:
432432
body: "${{ needs.generate-changelog.outputs.release_body }}"
433433
- name: Upload the pre-release
434434
if: ${{ contains(github.ref, '-') }}
435-
uses: svenstaro/upload-release-action@v2
435+
uses: svenstaro/upload-release-action@04733e069f2d7f7f0b4aebc4fbdbce8613b03ccd # v2
436436
with:
437437
repo_token: ${{ secrets.GITHUB_TOKEN }}
438438
file: git-cliff-${{ env.RELEASE_VERSION }}.x86_64.rpm
@@ -445,11 +445,11 @@ jobs:
445445
runs-on: ubuntu-22.04
446446
steps:
447447
- name: Checkout
448-
uses: actions/checkout@v4
448+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
449449
- name: Set the release version
450450
run: echo "RELEASE_VERSION=${GITHUB_REF:11}" >> $GITHUB_ENV
451451
- name: Install Rust toolchain
452-
uses: dtolnay/rust-toolchain@stable
452+
uses: dtolnay/rust-toolchain@4305c38b25d97ef35a8ad1f985ccf2d2242004f2 # stable
453453
with:
454454
targets: x86_64-unknown-linux-gnu
455455
- name: Prepare for the crates.io release
@@ -482,7 +482,7 @@ jobs:
482482
contents: read
483483
steps:
484484
- name: Bump formula
485-
uses: mislav/[email protected]
485+
uses: mislav/bump-homebrew-formula-action@8e2baa47daaa8db10fcdeb04105dfa6850eb0d68 # v3.4
486486
with:
487487
formula-name: git-cliff
488488
formula-path: Formula/g/git-cliff.rb

.github/workflows/check-semver.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ jobs:
1515
error_message: ${{ steps.check_semver.outputs.error_message }}
1616
steps:
1717
- name: Checkout
18-
uses: actions/checkout@v4
18+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1919

2020
- name: Run cargo-semver-checks
2121
id: check_semver
22-
uses: orhun/cargo-semver-checks-action@feat/add_action_output
22+
uses: orhun/cargo-semver-checks-action@cc19b888f2062f8cc964c1d52f7f29d910becb31 # feat/add_action_output
2323

2424
comment-on-pr:
2525
name: Comment on pull request
@@ -31,7 +31,7 @@ jobs:
3131
steps:
3232
- name: Comment
3333
if: ${{ needs.check-semver.outputs.error_message != null }}
34-
uses: marocchino/sticky-pull-request-comment@v2
34+
uses: marocchino/sticky-pull-request-comment@52423e01640425a022ef5fd42c6fb5f633a02728 # v2.9.1
3535
with:
3636
header: pr-semver-check-error
3737
message: |
@@ -47,7 +47,7 @@ jobs:
4747
4848
- name: Delete comment
4949
if: ${{ needs.check-semver.outputs.error_message == null }}
50-
uses: marocchino/sticky-pull-request-comment@v2
50+
uses: marocchino/sticky-pull-request-comment@52423e01640425a022ef5fd42c6fb5f633a02728 # v2.9.1
5151
with:
5252
header: pr-semver-check-error
5353
delete: true

0 commit comments

Comments
 (0)