Skip to content

Commit 688147e

Browse files
committedOct 19, 2024
ci(fix): run ghcr build in DevOps workflow for forks
1 parent 773a58e commit 688147e

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed
 

‎.github/workflows/devops.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,5 @@ jobs:
5454
needs:
5555
- check_paths
5656
- elixir_dep_verification_and_static_analysis
57-
# Only run if there are no changes to the github folder and for PR from non-forks
58-
if: needs.check_paths.outputs.githubfolder != 'true' && ( ${{ github.event.pull_request.head.repo.full_name }} == ${{ github.repository }}) || github.event_name == 'schedule'
57+
if: needs.check_paths.outputs.githubfolder != 'true'
5958
uses: ./.github/workflows/ghcr_build.yml

‎.github/workflows/ghcr_build.yml

+7-9
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ name: Build GHCR images
22

33
on:
44
workflow_call:
5-
pull_request_target:
65
branches: ["master"]
76
paths:
87
- "**/*"
@@ -25,8 +24,7 @@ jobs:
2524
teslamate_build:
2625
name: Build images
2726
needs: check_paths
28-
# Only run if there are no changes to the github folder and on workflow call, or PRs from forks (to avoid duplicate runs for PRs from non-forks, and to avoid invalid reference format for cache name in PRs from our repo)
29-
if: needs.check_paths.outputs.githubfolder != 'true' && (${{ github.event_name == 'workflow_call' }} || ${{ github.event.pull_request.head.repo.full_name }} != ${{ github.repository }})
27+
if: needs.check_paths.outputs.githubfolder != 'true'
3028
strategy:
3129
fail-fast: false
3230
matrix:
@@ -45,9 +43,10 @@ jobs:
4543
timeout-minutes: 10
4644
steps:
4745
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
48-
if: ${{ github.event_name != 'pull_request_target' }}
46+
if: ${{ github.event.pull_request.head.repo.full_name }} == ${{ github.repository }}
4947
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
50-
if: ${{ github.event_name == 'pull_request_target' }}
48+
# coming from a fork
49+
if: ${{ github.event.pull_request.head.repo.full_name }} != ${{ github.repository }}
5150
with:
5251
ref: ${{github.event.pull_request.head.ref}}
5352
repository: ${{github.event.pull_request.head.repo.full_name}}
@@ -88,14 +87,13 @@ jobs:
8887

8988
grafana:
9089
needs: check_paths
91-
# Only run if there are no changes to the github folder and on workflow call, or PRs from forks (to avoid duplicate runs for PRs from non-forks, and to avoid invalid reference format for cache name in PRs from our repo)
92-
if: needs.check_paths.outputs.githubfolder != 'true' && (${{ github.event_name == 'workflow_call' }} || ${{ github.event.pull_request.head.repo.full_name }} != ${{ github.repository }})
90+
if: needs.check_paths.outputs.githubfolder != 'true'
9391
runs-on: ubuntu-24.04
9492
steps:
9593
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
96-
if: ${{ github.event_name != 'pull_request_target' }}
94+
if: ${{ github.event.pull_request.head.repo.full_name }} == ${{ github.repository }}
9795
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
98-
if: ${{ github.event_name == 'pull_request_target' }}
96+
if: ${{ github.event.pull_request.head.repo.full_name }} != ${{ github.repository }}
9997
with:
10098
ref: ${{github.event.pull_request.head.ref}}
10199
repository: ${{github.event.pull_request.head.repo.full_name}}

0 commit comments

Comments
 (0)
Please sign in to comment.