Skip to content

Commit

Permalink
Use pull_request_target to get dependabot PRs to run
Browse files Browse the repository at this point in the history
  • Loading branch information
mkjpryor committed Nov 14, 2023
1 parent a6d6c74 commit 9200a66
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
13 changes: 8 additions & 5 deletions .github/workflows/build-push-artifacts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ on:
# Also allow publication to be done via a workflow call
# In this case, the chart version is returned as an output
workflow_call:
inputs:
ref:
type: string
description: The ref to build.
required: true
outputs:
chart-version:
description: The chart version that was published
Expand All @@ -26,12 +31,11 @@ jobs:
build_push_images:
name: Build and push images
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Check out the repository
uses: actions/checkout@v3
with:
ref: ${{ inputs.ref || github.ref }}

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
Expand Down Expand Up @@ -73,12 +77,11 @@ jobs:
needs: [build_push_images]
outputs:
chart-version: ${{ steps.semver.outputs.version }}
permissions:
contents: write
steps:
- name: Check out the repository
uses: actions/checkout@v3
with:
ref: ${{ inputs.ref || github.ref }}
# This is important for the semver action to work correctly
# when determining the number of commits since the last tag
fetch-depth: 0
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/test-pr.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
name: Test Azimuth deployment

on:
pull_request:
# We use pull_request_target so that dependabot-created workflows can run
pull_request_target:
types:
- opened
- synchronize
Expand All @@ -20,11 +21,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: PR must be from a branch in the stackhpc/azimuth-identity-operator repo
run: exit ${{ github.repository == 'stackhpc/azimuth-identity-operator' && '0' || '1' }}
run: exit ${{ github.event.pull_request.head.repo.full_name == 'stackhpc/azimuth-identity-operator' && '0' || '1' }}

publish_artifacts:
needs: [fail_on_remote]
uses: ./.github/workflows/build-push-artifacts.yaml
with:
ref: ${{ github.event.pull_request.head.sha }}
secrets: inherit

run_azimuth_tests:
needs: [publish_artifacts]
Expand Down

0 comments on commit 9200a66

Please sign in to comment.