Skip to content

Commit 3da0c4f

Browse files
authored
Lock workflow actions with an actions.lock file (#240)
Add .github/workflows/actions.lock generated by gh actions-lock v0.5.0 and a workflow that verifies it on pull requests. Workflow steps use release tags, and the lockfile pins each tag to the commit the SHA pin had. It also pins the actions that our actions use. Pin the home-assistant/actions branch refs (helpers and the reusable stale workflow) to the current master commit. Drop helpers:pinGitHubActionDigests from Renovate and let it bump the gh-actions-lock version in CI and its constraints. Drop the Renovate rule that kept our own branch refs floating. They are pinned now.
1 parent 4f1abcb commit 3da0c4f

8 files changed

Lines changed: 155 additions & 22 deletions

File tree

‎.gitattributes‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Generated by `gh actions-lock`. Highlight it as YAML and don't auto-merge it:
2+
# on a conflict, restore it from the base branch and run `gh actions-lock --no-narrow`.
3+
.github/workflows/actions.lock linguist-language=YAML -merge

‎.github/renovate.json‎

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
{
22
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
3-
"extends": ["helpers:pinGitHubActionDigests"],
43
"enabledManagers": ["dockerfile", "github-actions", "custom.regex"],
54
"ignorePaths": [".devcontainer/**"],
5+
"constraints": {
6+
"ghActionsLock": "v0.5.0"
7+
},
68
"customManagers": [
79
{
810
"description": "Update the Home Assistant CLI version pinned via ARG CLI_VERSION in the Dockerfile",
@@ -12,6 +14,20 @@
1214
"depNameTemplate": "home-assistant/cli",
1315
"datasourceTemplate": "github-releases",
1416
"versioningTemplate": "semver"
17+
},
18+
{
19+
"description": "Keep gh-actions-lock in CI and Renovate's lockfile generator on the same version",
20+
"customType": "regex",
21+
"managerFilePatterns": [
22+
"/^\\.github/workflows/actions-lock\\.yml$/",
23+
"/^\\.github/renovate\\.json$/"
24+
],
25+
"matchStrings": [
26+
"GH_ACTIONS_LOCK_VERSION: (?<currentValue>v\\d+\\.\\d+\\.\\d+)",
27+
"\"ghActionsLock\": \"(?<currentValue>v\\d+\\.\\d+\\.\\d+)\""
28+
],
29+
"depNameTemplate": "github/gh-actions-lock",
30+
"datasourceTemplate": "github-releases"
1531
}
1632
],
1733
"packageRules": [
@@ -44,13 +60,6 @@
4460
"matchDepTypes": ["github-runner", "uses-with"],
4561
"enabled": false
4662
},
47-
{
48-
"description": "Our own actions that follow a branch (like home-assistant/actions@master) float on purpose. Pinning them would open a digest PR in every repository for each change to them. Our own actions on a version tag are pinned like any other.",
49-
"matchManagers": ["github-actions"],
50-
"matchPackageNames": ["home-assistant/**"],
51-
"matchCurrentValue": "/^(dev|main|master)$/",
52-
"pinDigests": false
53-
},
5463
{
5564
"description": "Group the home-assistant/builder subactions into one PR (they share a release)",
5665
"matchPackageNames": ["/^home-assistant\\/builder(?:\\/|$)/"],

‎.github/workflows/actions-lock.yml‎

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Verify actions lockfile
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
paths:
8+
- ".github/actions/**"
9+
- ".github/workflows/**"
10+
pull_request:
11+
branches:
12+
- master
13+
14+
concurrency:
15+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
16+
cancel-in-progress: true
17+
18+
permissions:
19+
contents: read
20+
21+
jobs:
22+
verify:
23+
name: Verify actions lockfile
24+
runs-on: ubuntu-latest
25+
env:
26+
GH_ACTIONS_LOCK_VERSION: v0.5.0
27+
steps:
28+
- name: Check out files from GitHub
29+
uses: actions/checkout@v7.0.1
30+
with:
31+
persist-credentials: false
32+
- name: Check that branch refs are pinned to a commit
33+
run: |
34+
if grep -rnE --include='*.yml' --include='*.yaml' 'uses:\s*[^ #]+@(main|master|dev)\b' .github; then
35+
echo "::error::Pin branch refs as @<sha> # <branch>, actions.lock would freeze them"
36+
exit 1
37+
fi
38+
39+
- name: Install gh-actions-lock
40+
env:
41+
GH_TOKEN: ${{ github.token }}
42+
run: gh extension install github/gh-actions-lock --pin "${GH_ACTIONS_LOCK_VERSION}"
43+
- name: Verify lockfile
44+
env:
45+
GH_TOKEN: ${{ github.token }}
46+
run: gh actions-lock --verify

‎.github/workflows/actions.lock‎

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# This file is machine-generated by `gh actions-lock`.
2+
# Do not edit by hand; run `gh actions-lock` to update.
3+
# Docs: https://gh.io/actions-lockfile
4+
version: 'v0.0.3'
5+
workflows:
6+
'.github/workflows/actions-lock.yml':
7+
- 'actions/checkout@v7.0.1'
8+
'.github/workflows/builder.yml':
9+
- 'actions/checkout@v7.0.1'
10+
- 'home-assistant/actions@86d4564712fa02543c808e3a693dd04f9d3f8361'
11+
- 'home-assistant/builder@2026.09.0'
12+
'.github/workflows/hadolint.yml':
13+
- 'actions/checkout@v7.0.1'
14+
- 'brpaz/hadolint-action@v1.5.0'
15+
'.github/workflows/release-drafter.yml':
16+
- 'actions/checkout@v7.0.1'
17+
- 'release-drafter/release-drafter@v7.11.0'
18+
'.github/workflows/stale.yaml': []
19+
dependencies:
20+
'actions/checkout@v7.0.1':
21+
ref: 'v7.0.1'
22+
commit: 'sha1-3d3c42e5aac5ba805825da76410c181273ba90b1'
23+
owner_id: 44036562
24+
repo_id: 197814629
25+
'brpaz/hadolint-action@v1.5.0':
26+
ref: 'v1.5.0'
27+
commit: 'sha1-c27bd9edc1e95eed30474db8f295ff5807ebca14'
28+
owner_id: 184563
29+
repo_id: 368274147
30+
'docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a':
31+
ref: 'v7.3.0'
32+
commit: 'sha1-53b7df96c91f9c12dcc8a07bcb9ccacbed38856a'
33+
owner_id: 5429470
34+
repo_id: 241092383
35+
'docker/login-action@dbcb813823bdd20940b903addbd779551569679f':
36+
ref: 'v4.6.0'
37+
commit: 'sha1-dbcb813823bdd20940b903addbd779551569679f'
38+
owner_id: 5429470
39+
repo_id: 287743349
40+
'docker/setup-buildx-action@37fe631027851001ddb9b187196cc803df7f5f0e':
41+
ref: 'v4.3.0'
42+
commit: 'sha1-37fe631027851001ddb9b187196cc803df7f5f0e'
43+
owner_id: 5429470
44+
repo_id: 288485773
45+
'home-assistant/actions@86d4564712fa02543c808e3a693dd04f9d3f8361':
46+
ref: 'master'
47+
commit: 'sha1-86d4564712fa02543c808e3a693dd04f9d3f8361'
48+
owner_id: 13844975
49+
repo_id: 173703505
50+
'home-assistant/builder@2026.09.0':
51+
ref: '2026.09.0'
52+
commit: 'sha1-7412f0023ea9b6e58e8bb5059f1660f51376f49a'
53+
owner_id: 13844975
54+
repo_id: 181371487
55+
uses:
56+
- 'docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a'
57+
- 'docker/login-action@dbcb813823bdd20940b903addbd779551569679f'
58+
- 'docker/setup-buildx-action@37fe631027851001ddb9b187196cc803df7f5f0e'
59+
- 'home-assistant/builder@4de35182ce1e329181bffcbcc84d33db5e2c7e10'
60+
- 'sigstore/cosign-installer@6f9f17788090df1f26f669e9d70d6ae9567deba6'
61+
'home-assistant/builder@4de35182ce1e329181bffcbcc84d33db5e2c7e10':
62+
ref: '2026.06.0'
63+
commit: 'sha1-4de35182ce1e329181bffcbcc84d33db5e2c7e10'
64+
owner_id: 13844975
65+
repo_id: 181371487
66+
'release-drafter/release-drafter@v7.11.0':
67+
ref: 'v7.11.0'
68+
commit: 'sha1-d1a19e60e81a7e650d00a7de9277f87e439117ea'
69+
owner_id: 58292376
70+
repo_id: 139022359
71+
'sigstore/cosign-installer@6f9f17788090df1f26f669e9d70d6ae9567deba6':
72+
ref: 'v4.1.2'
73+
commit: 'sha1-6f9f17788090df1f26f669e9d70d6ae9567deba6'
74+
owner_id: 71096353
75+
repo_id: 351211695

‎.github/workflows/builder.yml‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,19 @@ jobs:
3131
matrix: ${{ steps.matrix.outputs.matrix }}
3232
steps:
3333
- name: Checkout the repository
34-
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
34+
uses: actions/checkout@v7.0.1
3535
with:
3636
fetch-depth: 0
3737

3838
- name: Get version
3939
id: version
40-
uses: home-assistant/actions/helpers/version@master
40+
uses: home-assistant/actions/helpers/version@86d4564712fa02543c808e3a693dd04f9d3f8361 # master
4141
with:
4242
type: ${{ env.BUILD_TYPE }}
4343

4444
- name: Get build matrix
4545
id: matrix
46-
uses: home-assistant/builder/actions/prepare-multi-arch-matrix@7412f0023ea9b6e58e8bb5059f1660f51376f49a # 2026.09.0
46+
uses: home-assistant/builder/actions/prepare-multi-arch-matrix@2026.09.0
4747
with:
4848
architectures: ${{ env.ARCHITECTURES }}
4949
image-name: ${{ env.IMAGE_NAME }}
@@ -61,13 +61,13 @@ jobs:
6161
matrix: ${{ fromJSON(needs.init.outputs.matrix) }}
6262
steps:
6363
- name: Checkout the repository
64-
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
64+
uses: actions/checkout@v7.0.1
6565
with:
6666
persist-credentials: false
6767

6868
- name: Build image
6969
id: build
70-
uses: home-assistant/builder/actions/build-image@7412f0023ea9b6e58e8bb5059f1660f51376f49a # 2026.09.0
70+
uses: home-assistant/builder/actions/build-image@2026.09.0
7171
with:
7272
arch: ${{ matrix.arch }}
7373
container-registry-password: ${{ secrets.GITHUB_TOKEN }}
@@ -90,7 +90,7 @@ jobs:
9090
packages: write
9191
steps:
9292
- name: Publish multi-arch manifest
93-
uses: home-assistant/builder/actions/publish-multi-arch-manifest@7412f0023ea9b6e58e8bb5059f1660f51376f49a # 2026.09.0
93+
uses: home-assistant/builder/actions/publish-multi-arch-manifest@2026.09.0
9494
with:
9595
architectures: ${{ env.ARCHITECTURES }}
9696
container-registry-password: ${{ secrets.GITHUB_TOKEN }}
@@ -107,19 +107,19 @@ jobs:
107107
steps:
108108
- name: Checkout the repository
109109
if: needs.init.outputs.publish == 'true'
110-
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
110+
uses: actions/checkout@v7.0.1
111111

112112
- name: Initialize git
113113
if: needs.init.outputs.publish == 'true'
114-
uses: home-assistant/actions/helpers/git-init@master
114+
uses: home-assistant/actions/helpers/git-init@86d4564712fa02543c808e3a693dd04f9d3f8361 # master
115115
with:
116116
name: ${{ secrets.GIT_NAME }}
117117
email: ${{ secrets.GIT_EMAIL }}
118118
token: ${{ secrets.GIT_TOKEN }}
119119

120120
- name: Update version file
121121
if: needs.init.outputs.publish == 'true'
122-
uses: home-assistant/actions/helpers/version-push@master
122+
uses: home-assistant/actions/helpers/version-push@86d4564712fa02543c808e3a693dd04f9d3f8361 # master
123123
with:
124124
key: ${{ env.BUILD_NAME }}
125125
version: ${{ needs.init.outputs.version }}

‎.github/workflows/hadolint.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ jobs:
99
name: lint
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
13-
- uses: brpaz/hadolint-action@c27bd9edc1e95eed30474db8f295ff5807ebca14 # v1.5.0
12+
- uses: actions/checkout@v7.0.1
13+
- uses: brpaz/hadolint-action@v1.5.0

‎.github/workflows/release-drafter.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
name: Release Drafter
1212
steps:
1313
- name: Checkout the repository
14-
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
14+
uses: actions/checkout@v7.0.1
1515
with:
1616
fetch-depth: 0
1717

@@ -36,7 +36,7 @@ jobs:
3636
echo "::set-output name=version::$datepre.$newpost"
3737
3838
- name: Run Release Drafter
39-
uses: release-drafter/release-drafter@d1a19e60e81a7e650d00a7de9277f87e439117ea # v7.11.0
39+
uses: release-drafter/release-drafter@v7.11.0
4040
with:
4141
tag: ${{ steps.version.outputs.version }}
4242
name: ${{ steps.version.outputs.version }}

‎.github/workflows/stale.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ on:
88

99
jobs:
1010
workflows:
11-
uses: home-assistant/actions/.github/workflows/stale.yaml@master
11+
uses: home-assistant/actions/.github/workflows/stale.yaml@86d4564712fa02543c808e3a693dd04f9d3f8361 # master

0 commit comments

Comments
 (0)