Skip to content

Commit

Permalink
Merge pull request cloudfoundry#19 from cloudfoundry/skipping-steps-f…
Browse files Browse the repository at this point in the history
…or-forks

Skipping steps for forks
  • Loading branch information
garethjevans authored Aug 12, 2021
2 parents 57b7458 + 6b840c8 commit e42fa5e
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion .github/workflows/image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,23 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v2

- name: Prepare
id: prep
run: |
EVENT_NAME=${{ github.event_name }}
IS_FORK=${{ github.event.pull_request.head.repo.fork }}
if [ "$EVENT_NAME"=="push" ]; then
echo "::set-output name=should_push::true"
elif [ "$EVENT_NAME"=="pull_request" ]; then
if [ "$IS_FORK"=="true" ]; then
echo "::set-output name=should_push::false"
else
echo "::set-output name=should_push::true"
fi
fi
- name: Log in to the Container registry
if: ${{ steps.prep.outputs.should_push == 'true' }}
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ${{ env.REGISTRY }}
Expand All @@ -41,6 +57,6 @@ jobs:
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: dockerfiles/autoscaler-${{ matrix.image_suffix }}
push: true
push: ${{ steps.prep.outputs.should_push == 'true' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

0 comments on commit e42fa5e

Please sign in to comment.