Skip to content

Commit 9ce782c

Browse files
committed
fix: add correct permissions
1 parent cd1ae4e commit 9ce782c

File tree

4 files changed

+28
-24
lines changed

4 files changed

+28
-24
lines changed

.github/workflows/build-and-push.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@ name: Build and Push Docker Image
22

33
on:
44
workflow_call:
5+
inputs:
6+
push_image:
7+
description: 'Whether to push the Docker image'
8+
type: boolean
9+
required: false
10+
default: false
511

612
jobs:
713
build:
@@ -26,6 +32,7 @@ jobs:
2632
run: npm test
2733

2834
- name: Log in to GitHub Container Registry
35+
if: inputs.push_image
2936
uses: docker/login-action@v3
3037
with:
3138
registry: ghcr.io
@@ -39,6 +46,7 @@ jobs:
3946
run: npm run build:dockerImage
4047

4148
- name: Push Docker image
49+
if: inputs.push_image
4250
env:
4351
DOCKER_USERNAME: ${{ github.repository_owner }}
4452
run: |

.github/workflows/development.yml

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,13 @@ on:
66
branches:
77
- '*'
88
- '!master'
9-
pull_request:
9+
10+
permissions:
11+
contents: read
12+
packages: write
1013

1114
jobs:
1215
build:
13-
runs-on: ubuntu-latest
14-
15-
steps:
16-
- uses: actions/checkout@v3
17-
- uses: actions/setup-node@v3
18-
with:
19-
node-version: '22'
20-
21-
- name: install dependencies
22-
run: npm i
23-
24-
- name: dependency check
25-
run: npm run dependencyCheck
26-
27-
- name: run tests
28-
run: npm test
29-
30-
- name: build app & docker image
31-
env:
32-
DOCKER_REGISTRY: ghcr.io
33-
DOCKER_USERNAME: ${{ github.repository_owner }}
34-
run: npm run build:dockerImage
16+
uses: ./.github/workflows/build-and-push.yml
17+
with:
18+
push_image: false

.github/workflows/master.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ on:
99
tags:
1010
- '*'
1111

12+
permissions:
13+
contents: read
14+
packages: write
15+
1216
jobs:
1317
build-and-push:
1418
uses: ./.github/workflows/build-and-push.yml
19+
with:
20+
push_image: true

.github/workflows/release.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ on:
44
release:
55
types: [created]
66

7+
permissions:
8+
contents: read
9+
packages: write
10+
711
jobs:
812
build-and-push:
9-
uses: ./.github/workflows/build-and-push.yml
13+
uses: ./.github/workflows/build-and-push.yml
14+
with:
15+
push_image: true

0 commit comments

Comments
 (0)