Skip to content

Commit 57b5b95

Browse files
committed
feat!: token input for shared actions
1 parent 9efc970 commit 57b5b95

3 files changed

Lines changed: 17 additions & 10 deletions

File tree

.github/workflows/multi-runner-build.yml

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,12 @@ on:
4040
type: string
4141
default: 'semver'
4242
secrets:
43+
GITHUB_APP_TOKEN:
44+
required:
4345
DOCKERHUB_USERNAME:
4446
required: false
4547
DOCKERHUB_TOKEN:
4648
required: false
47-
4849
env:
4950
GHCR_IMAGE: ghcr.io/${{ github.repository_owner }}/${{ inputs.image }}
5051
DOCKERHUB_IMAGE: altran1502/${{ inputs.image }}
@@ -83,9 +84,6 @@ jobs:
8384
build:
8485
needs: matrix
8586
runs-on: ${{ matrix.runner }}
86-
permissions:
87-
contents: read
88-
packages: write
8987
strategy:
9088
fail-fast: false
9189
matrix:
@@ -95,13 +93,14 @@ jobs:
9593
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
9694
with:
9795
persist-credentials: false
96+
token: ${{ secrets.GITHUB_APP_TOKEN }}
9897

9998
- uses: immich-app/devtools/actions/image-build@7d95e52a7a597ce005a306d6891467fc15427b69 # image-build-action-0.1.1
10099
with:
101100
context: ${{ inputs.context }}
102101
dockerfile: ${{ inputs.dockerfile }}
103102
image: ${{ env.GHCR_IMAGE }}
104-
ghcr-token: ${{ secrets.GITHUB_TOKEN }}
103+
ghcr-token: ${{ secrets.GITHUB_APP_TOKEN }}
105104
platform: ${{ matrix.platform }}
106105
artifact-key-base: ${{ needs.matrix.outputs.key }}
107106
build-args: ${{ inputs.build-args }}
@@ -111,17 +110,14 @@ jobs:
111110
needs: [matrix, build]
112111
runs-on: ubuntu-latest
113112
if: ${{ !github.event.pull_request.head.repo.fork }}
114-
permissions:
115-
contents: read
116-
actions: read
117-
packages: write
118113
steps:
119114
- name: Download digests
120115
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
121116
with:
122117
path: ${{ runner.temp }}/digests
123118
pattern: ${{ needs.matrix.outputs.key }}-*
124119
merge-multiple: true
120+
github-token: ${{ secrets.GITHUB_APP_TOKEN }}
125121

126122
- name: Login to Docker Hub
127123
if: ${{ inputs.dockerhub-push }}
@@ -135,7 +131,7 @@ jobs:
135131
with:
136132
registry: ghcr.io
137133
username: ${{ github.repository_owner }}
138-
password: ${{ secrets.GITHUB_TOKEN }}
134+
password: ${{ secrets.GITHUB_APP_TOKEN }}
139135

140136
- name: Set up Docker Buildx
141137
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1

actions/pre-job/action.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ inputs:
44
filters:
55
description: 'Path filters as YAML string'
66
required: true
7+
github-token:
8+
description: 'Github token to use'
9+
required: true
710
force-filters:
811
description: 'Additional path filters that trigger force-run (e.g., workflow files)'
912
required: false
@@ -190,6 +193,7 @@ runs:
190193
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
191194
with:
192195
persist-credentials: false
196+
token: ${{ inputs.github-token }}
193197

194198
- name: Check force paths
195199
if: ${{ steps.check-conditions.outputs.needs_path_filtering == 'true' && inputs.force-filters != '' }}
@@ -240,13 +244,15 @@ runs:
240244
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
241245
with:
242246
filters: ${{ steps.force_paths.outputs.force-paths-yaml }}
247+
token: ${{ inputs.github-token }}
243248

244249
- name: Check main paths
245250
if: ${{ steps.check-conditions.outputs.needs_path_filtering == 'true' && (inputs.force-filters == '' || steps.force_paths_filter.outputs.force-paths != 'true') }}
246251
id: main_paths
247252
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
248253
with:
249254
filters: ${{ inputs.filters }}
255+
token: ${{ inputs.github-token }}
250256

251257
- name: Generate final outputs
252258
id: generate-outputs

actions/use-mise/action.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
name: 'Use Mise'
22
description: 'Use Mise with a pinned version'
3+
inputs:
4+
github-token:
5+
description: 'Github token to use'
6+
required: true
37
runs:
48
using: 'composite'
59
steps:
610
- uses: jdx/mise-action@c37c93293d6b742fc901e1406b8f764f6fb19dac # v2.4.4
711
with:
12+
github_token: ${{ inputs.GITHUB_TOKEN }}
813
version: 2025.7.12
914
sha256: ${{ runner.os == 'Linux' && runner.arch == 'X64' && '78e141b547e4b50dac6b97f9be35e117f6a3e520aa6891aa5ee75c956585d5d2' ||
1015
runner.os == 'Linux' && runner.arch == 'ARM64' && '2e06c7bc32263d7a4ec45edb760922c85e37adba048dc1249d281cbf46e7f703' ||

0 commit comments

Comments
 (0)