File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change 55 branches :
66 - development
77 tags :
8- - " v*" # Triggers on version tags like v1.0.0
8+ - " v*"
99 pull_request :
1010 branches :
1111 - main
12- workflow_dispatch : # Allow manual trigger
12+ workflow_dispatch :
1313
1414jobs :
1515 build :
1616 runs-on : ubuntu-latest
1717
18+ permissions :
19+ contents : read
20+ packages : write # notwendig für GHCR push
21+ pull-requests : read
22+
1823 steps :
1924 - name : Checkout code
2025 uses : actions/checkout@v3
@@ -23,16 +28,17 @@ jobs:
2328 uses : docker/setup-buildx-action@v2
2429
2530 - name : Log in to GitHub Container Registry
31+ if : github.event.pull_request.head.repo.full_name == github.repository # verhindert push bei externen PRs
2632 uses : docker/login-action@v2
2733 with :
2834 registry : ghcr.io
2935 username : ${{ github.actor }}
3036 password : ${{ secrets.GITHUB_TOKEN }}
31-
37+
3238 - name : Build and push Docker image
3339 uses : docker/build-push-action@v5
3440 with :
35- push : ${{ github.event_name != 'pull_request' }}
41+ push : ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }}
3642 tags : |
3743 ghcr.io/${{ github.repository_owner }}/react-ardublockly-backend:latest
3844 ghcr.io/${{ github.repository_owner }}/react-ardublockly-backend:${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.pull_request.number) || github.ref_name }}
You can’t perform that action at this time.
0 commit comments