Skip to content

Commit

Permalink
Merge pull request #25 from NVIDIA/simplify-gitcontainer-builds
Browse files Browse the repository at this point in the history
Skip contianer build workflow on PRs from forks.
  • Loading branch information
elezar authored Nov 21, 2023
2 parents def1002 + ed91861 commit 1bdce27
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/build-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,12 @@ on:

jobs:
build-image:
if: (github.event.action != 'closed' || github.event.pull_request.merged == true)
# We trigger builds on MERGED pull requests or on non-closed PRs that are not created against a fork.
if: (github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true) || (github.event_name == 'pull_request' && github.event.action != 'closed' && github.event.pull_request.head.repo.full_name == github.repository)
runs-on: ubuntu-latest
strategy:
matrix:
dist: [ubuntu20.04, ubi8]
dist: [ubuntu20.04]
steps:
- uses: actions/checkout@v3

Expand All @@ -40,6 +41,9 @@ jobs:
run: |
echo "COMMIT_SHORT_SHA=${GITHUB_SHA:0:8}" >> $GITHUB_ENV
echo "LOWERCASE_REPO_OWNER=$(echo "${GITHUB_REPOSITORY_OWNER}" | awk '{print tolower($0)}')" >> $GITHUB_ENV
REPO_FULL_NAME="${{ github.event.pull_request.head.repo.full_name }}"
echo "${REPO_FULL_NAME}"
echo "LABEL_IMAGE_SOURCE=https://github.com/${REPO_FULL_NAME}" >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
Expand Down
1 change: 1 addition & 0 deletions deployments/container/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ $(IMAGE_TARGETS): image-%:
--build-arg GOLANG_VERSION="$(GOLANG_VERSION)" \
--build-arg VERSION="$(VERSION)" \
--build-arg GIT_COMMIT="$(GIT_COMMIT)" \
$(if $(LABEL_IMAGE_SOURCE),--label "org.opencontainers.image.source=$(LABEL_IMAGE_SOURCE)",) \
-f $(DOCKERFILE) \
$(CURDIR)

Expand Down

0 comments on commit 1bdce27

Please sign in to comment.