Skip to content

Commit 3de962f

Browse files
authored
Refactor/remove old branch caches and add actionlint (#5142)
* ci(cache): add github action to remove merged branches caches * refactor(ci): bump github actions versions * feat(ci): add actionlint to the github actions lint
1 parent 6fb3f69 commit 3de962f

7 files changed

Lines changed: 95 additions & 51 deletions

File tree

‎.github/workflows/build-docker-proto-image.yaml‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313

1414
steps:
1515
- name: Checkout harmony core code
16-
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 #v7.0.0
16+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 #v7.0.1
1717
with:
1818
path: harmony
1919
ref: ${{ github.ref }}
@@ -32,16 +32,16 @@ jobs:
3232
echo "full_sha=${FULL_SHA}" >> "$GITHUB_OUTPUT"
3333
3434
- name: Set up QEMU
35-
uses: docker/setup-qemu-action@96fe6ef7f33517b61c61be40b68a1882f3264fb8 #v4.2.0
35+
uses: docker/setup-qemu-action@1f40c72289eff860ee54a304f1438e3cff362e0a #v4.3.0
3636
with:
3737
platforms: arm64
3838
cache-image: false
3939

4040
- name: Set up Docker Buildx
41-
uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c #v4.2.0
41+
uses: docker/setup-buildx-action@37fe631027851001ddb9b187196cc803df7f5f0e #v4.3.0
4242

4343
- name: Login to DockerHub
44-
uses: docker/login-action@c99871dec2022cc055c062a10cc1a1310835ceb4 #v4.3.0
44+
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f #v4.6.0
4545
with:
4646
username: ${{ secrets.DOCKER_USERNAME }}
4747
password: ${{ secrets.DOCKER_PASSWORD }}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Inspired by https://docs.github.com/en/actions/how-tos/manage-workflow-runs/manage-caches#deleting-cache-entries
2+
# But I've used 2 flags instead of for cycle and ignoring errors:
3+
# `--all` deletes every cache matching the PR ref
4+
# `--succeed-on-no-caches` - green when there is simply nothing to delete, but still allowing real errors
5+
# like auth or API failures to fail the workflow
6+
name: Cleanup GitHub runner caches on closed pull requests
7+
8+
on:
9+
pull_request:
10+
types:
11+
- closed
12+
13+
permissions:
14+
contents: read
15+
16+
jobs:
17+
cleanup:
18+
runs-on: ubuntu-24.04
19+
permissions:
20+
actions: write
21+
22+
steps:
23+
- name: Cleanup PR caches
24+
env:
25+
GH_TOKEN: ${{ github.token }}
26+
GH_REPO: ${{ github.repository }}
27+
PR_REF: refs/pull/${{ github.event.pull_request.number }}/merge
28+
run: |
29+
set -euo pipefail
30+
echo "Deleting caches for ${PR_REF}"
31+
gh cache delete \
32+
--all \
33+
--ref "${PR_REF}" \
34+
--succeed-on-no-caches
35+
echo "Done"

‎.github/workflows/ci-pr.yaml‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@ jobs:
3434
steps:
3535
- &checkout-harmony
3636
name: Checkout harmony
37-
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 #v7.0.0
37+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 #v7.0.1
3838
with:
3939
ref: ${{ github.sha }}
4040
path: go/src/github.com/harmony-one/harmony
4141
persist-credentials: false
4242

4343
- name: Set up Go
44-
uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 #v6.5.0
44+
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e #v7.0.0
4545
with:
4646
go-version: '1.24.2'
4747
cache-dependency-path: go/src/github.com/harmony-one/harmony/go.sum
@@ -70,7 +70,7 @@ jobs:
7070
steps:
7171
- *checkout-harmony
7272
- name: Set up Go with race cache
73-
uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 #v6.5.0
73+
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e #v7.0.0
7474
with:
7575
go-version: '1.24.2'
7676
# Keep race-enabled build artifacts separate from the regular build cache.
@@ -118,7 +118,7 @@ jobs:
118118
119119
- &checkout-harmony-test
120120
name: Checkout harmony-test
121-
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 #v7.0.0
121+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 #v7.0.1
122122
with:
123123
repository: harmony-one/harmony-test
124124
ref: master

‎.github/workflows/ci-release.yaml‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
4949
5050
- name: Checkout harmony core code
51-
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 #v7.0.0
51+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 #v7.0.1
5252
with:
5353
path: harmony
5454
ref: refs/tags/${{ steps.resolve-tag.outputs.tag }}
@@ -84,15 +84,15 @@ jobs:
8484

8585
steps:
8686
- name: Checkout harmony core code
87-
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 #v7.0.0
87+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 #v7.0.1
8888
with:
8989
path: harmony
9090
ref: refs/tags/${{ needs.check.outputs.tag }}
9191
fetch-depth: 1
9292
persist-credentials: false
9393

9494
- name: Set up Go with go.mod
95-
uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 #v6.5.0
95+
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e #v7.0.0
9696
with:
9797
go-version-file: harmony/go.mod
9898
# Release artifacts should not restore mutable CI/PR caches.
@@ -144,7 +144,7 @@ jobs:
144144

145145
steps:
146146
- name: Checkout Dockerfile and .dockerignore
147-
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 #v7.0.0
147+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 #v7.0.1
148148
with:
149149
path: harmony
150150
ref: refs/tags/${{ needs.check.outputs.tag }}
@@ -184,10 +184,10 @@ jobs:
184184
cache-image: false
185185

186186
- name: Set up Docker Buildx
187-
uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c #v4.2.0
187+
uses: docker/setup-buildx-action@37fe631027851001ddb9b187196cc803df7f5f0e #v4.3.0
188188

189189
- name: Login to DockerHub
190-
uses: docker/login-action@c99871dec2022cc055c062a10cc1a1310835ceb4 #v4.3.0
190+
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f #v4.6.0
191191
with:
192192
username: ${{ secrets.DOCKER_USERNAME }}
193193
password: ${{ secrets.DOCKER_PASSWORD }}
@@ -215,7 +215,7 @@ jobs:
215215

216216
steps:
217217
- name: Checkout harmony core code
218-
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 #v7.0.0
218+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 #v7.0.1
219219
with:
220220
path: harmony
221221
ref: refs/tags/${{ needs.check.outputs.tag }}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: GitHub Actions Security Analysis with zizmor 🌈 and actionlint
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- dev
8+
paths:
9+
- '.github/workflows/**/*.yml'
10+
- '.github/workflows/**/*.yaml'
11+
12+
pull_request:
13+
branches: ["**"]
14+
paths:
15+
- '.github/workflows/**/*.yml'
16+
- '.github/workflows/**/*.yaml'
17+
18+
permissions: {}
19+
20+
jobs:
21+
zizmor:
22+
name: Run zizmor 🌈
23+
runs-on: ubuntu-latest
24+
steps:
25+
- &checkout-repository
26+
name: Checkout repository
27+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 #v7.0.1
28+
with:
29+
persist-credentials: false
30+
fetch-depth: 1
31+
32+
- name: Run zizmor 🌈
33+
uses: zizmorcore/zizmor-action@70fb788f84895a7701f5643d103d587e460b5c99 # v0.6.3
34+
with:
35+
inputs: ./.github/
36+
advanced-security: false
37+
38+
actionlint:
39+
name: Run actionlint
40+
runs-on: ubuntu-latest
41+
steps:
42+
- *checkout-repository
43+
- name: Run actionlint # Docu: https://github.com/rhysd/actionlint/blob/main/docs/usage.md#docker
44+
uses: docker://rhysd/actionlint@sha256:9d36088643581e728c969f35141f88139fec77280b2be23c1f66f8e40e1025e7 #v1.7.12

‎.github/workflows/mesh-cli-release-check.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
timeout-minutes: 5
1616
steps:
1717
- name: Checkout harmony
18-
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 #v7.0.0
18+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 #v7.0.1
1919
with:
2020
persist-credentials: false
2121

‎.github/workflows/zizmor.yaml‎

Lines changed: 0 additions & 35 deletions
This file was deleted.

0 commit comments

Comments
 (0)