mirror of
https://github.com/teslamate-org/teslamate.git
synced 2026-01-24 21:06:08 +08:00
ci(fix): run ghcr build in DevOps workflow for forks
This commit is contained in:
@@ -54,6 +54,5 @@ jobs:
|
||||
needs:
|
||||
- check_paths
|
||||
- elixir_dep_verification_and_static_analysis
|
||||
# Only run if there are no changes to the github folder and for PR from non-forks
|
||||
if: needs.check_paths.outputs.githubfolder != 'true' && ( ${{ github.event.pull_request.head.repo.full_name }} == ${{ github.repository }}) || github.event_name == 'schedule'
|
||||
if: needs.check_paths.outputs.githubfolder != 'true'
|
||||
uses: ./.github/workflows/ghcr_build.yml
|
||||
|
||||
@@ -2,7 +2,6 @@ name: Build GHCR images
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
pull_request_target:
|
||||
branches: ["master"]
|
||||
paths:
|
||||
- "**/*"
|
||||
@@ -25,8 +24,7 @@ jobs:
|
||||
teslamate_build:
|
||||
name: Build images
|
||||
needs: check_paths
|
||||
# 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)
|
||||
if: needs.check_paths.outputs.githubfolder != 'true' && (${{ github.event_name == 'workflow_call' }} || ${{ github.event.pull_request.head.repo.full_name }} != ${{ github.repository }})
|
||||
if: needs.check_paths.outputs.githubfolder != 'true'
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
@@ -45,9 +43,10 @@ jobs:
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
|
||||
if: ${{ github.event_name != 'pull_request_target' }}
|
||||
if: ${{ github.event.pull_request.head.repo.full_name }} == ${{ github.repository }}
|
||||
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
|
||||
if: ${{ github.event_name == 'pull_request_target' }}
|
||||
# coming from a fork
|
||||
if: ${{ github.event.pull_request.head.repo.full_name }} != ${{ github.repository }}
|
||||
with:
|
||||
ref: ${{github.event.pull_request.head.ref}}
|
||||
repository: ${{github.event.pull_request.head.repo.full_name}}
|
||||
@@ -88,14 +87,13 @@ jobs:
|
||||
|
||||
grafana:
|
||||
needs: check_paths
|
||||
# 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)
|
||||
if: needs.check_paths.outputs.githubfolder != 'true' && (${{ github.event_name == 'workflow_call' }} || ${{ github.event.pull_request.head.repo.full_name }} != ${{ github.repository }})
|
||||
if: needs.check_paths.outputs.githubfolder != 'true'
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
|
||||
if: ${{ github.event_name != 'pull_request_target' }}
|
||||
if: ${{ github.event.pull_request.head.repo.full_name }} == ${{ github.repository }}
|
||||
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
|
||||
if: ${{ github.event_name == 'pull_request_target' }}
|
||||
if: ${{ github.event.pull_request.head.repo.full_name }} != ${{ github.repository }}
|
||||
with:
|
||||
ref: ${{github.event.pull_request.head.ref}}
|
||||
repository: ${{github.event.pull_request.head.repo.full_name}}
|
||||
|
||||
Reference in New Issue
Block a user