Skip to content

Commit 9f8defe

Browse files
cpb8010Copilot
andauthored
feat: only build and push where permissions are (#181)
* feat: only build and push where permissions are Also allow this to be run manually in case you aren't merging to main or have forked this repo to a different name within the matter-labs org that does have the needed docker permissions. * Update .github/workflows/push-oidc-containers.yml love it Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 06bdc4c commit 9f8defe

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

.github/workflows/push-oidc-containers.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ on:
1010
pull_request:
1111
branches:
1212
- main
13+
workflow_dispatch:
1314

1415
concurrency:
1516
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
@@ -19,6 +20,9 @@ jobs:
1920
build-push-image:
2021
name: Build and push Docker image
2122
runs-on: [matterlabs-ci-runner]
23+
# Only run docker build/push for the main repository, not forks
24+
# Allow manual dispatch from any repository
25+
if: github.repository == 'matter-labs/zksync-sso'
2226
steps:
2327
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2428
with:
@@ -39,7 +43,7 @@ jobs:
3943
elif [[ "${{ github.event_name }}" == "pull_request" ]]; then
4044
echo "tag=none" >> $GITHUB_OUTPUT
4145
else
42-
echo "Unsupported event ${GITHUB_EVENT_NAME} or ref ${GITHUB_REF}, only refs/heads/, refs/tags/ and pull_request are supported."
46+
echo "Unsupported event ${GITHUB_EVENT_NAME} or ref ${GITHUB_REF}, only refs/heads/, refs/tags/, pull_request, and workflow_dispatch are supported."
4347
exit 1
4448
fi
4549
@@ -63,7 +67,7 @@ jobs:
6367
context: .
6468
file: Dockerfile
6569
target: oidc-server
66-
push: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) }}
70+
push: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) || github.event_name == 'workflow_dispatch' }}
6771
tags: |
6872
matterlabs/sso-oidc-salt:${{ steps.docker_tag.outputs.tag }}
6973
matterlabs/sso-oidc-salt:latest
@@ -77,7 +81,7 @@ jobs:
7781
context: .
7882
file: Dockerfile
7983
target: key-registry
80-
push: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) }}
84+
push: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) || github.event_name == 'workflow_dispatch' }}
8185
tags: |
8286
matterlabs/sso-oidc-key-updater:${{ steps.docker_tag.outputs.tag }}
8387
matterlabs/sso-oidc-key-updater:latest

0 commit comments

Comments
 (0)