Remove pull_request_target from workflows that push images

Signed-off-by: Tim Etchells <tetchell@redhat.com>
This commit is contained in:
Tim Etchells 2021-02-20 13:37:54 -05:00
parent f52484f302
commit 74b235b626
2 changed files with 20 additions and 18 deletions

View file

@ -2,7 +2,10 @@
# is some change in code done to ensure that the changes
# are not buggy and we are getting the desired output.
name: Test Build and Push
on: [ push, workflow_dispatch, pull_request_target ]
on:
push:
workflow_dispatch:
env:
PROJECT_DIR: spring-petclinic
IMAGE_NAME: spring-petclinic
@ -28,14 +31,14 @@ jobs:
with:
repository: "spring-projects/spring-petclinic"
path: ${{ env.PROJECT_DIR }}
# If none of these files has changed, we assume that the contents of
# .m2/repository can be fetched from the cache.
- name: Hash Maven files
working-directory: ${{ env.PROJECT_DIR }}
run: |
echo "MVN_HASH=${{ hashFiles('**/pom.xml', '.mvn/**/*', 'mvnw*') }}" >> $GITHUB_ENV
# Download the m2 repository from the cache to speed up the build.
- name: Check for Maven cache
id: check-mvn-cache
@ -54,7 +57,7 @@ jobs:
- name: Maven
working-directory: ${{ env.PROJECT_DIR }}
run: |
mvn package -ntp -B
mvn package -ntp -B
# If there was no cache hit above, store the output into the cache now.
- name: Save Maven repo into cache
@ -63,7 +66,7 @@ jobs:
with:
path: ${{ env.MVN_REPO_DIR }}
key: ${{ env.MVN_HASH }}
# Build image using Buildah action
- name: Build Image
id: build_image
@ -81,7 +84,7 @@ jobs:
spring-petclinic-*.jar
port: 8080
oci: 'true'
# Push the image to Quay.io (Image Registry)
- name: Push To Quay
uses: ./push-to-registry/
@ -94,7 +97,7 @@ jobs:
password: ${{ secrets.REGISTRY_PASSWORD }}
extra-args: |
--disable-content-trust
- name: Echo outputs
run: |
echo "Digest: ${{ steps.push.outputs.digest }}"