Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Docker build errors when opening a PR from a fork. #149

Merged
merged 1 commit into from
Jul 30, 2024

Conversation

antoinevg
Copy link
Member

@antoinevg antoinevg commented Jul 30, 2024

As per spec :-)

  • Main check is:

    - name: Use 'main' Docker image tag if this is a PR from a fork
    id: origin
    shell: bash
    if: github.event.pull_request.head.repo.fork
    run: |
    echo 'IMAGE_TAG=main' >> $GITHUB_ENV

  • Because the logic for whether we're doing a build or not is getting complex it now gets its own step:

    - name: Check if we need to build the Docker image
    id: dockerimage
    if: |
    ! github.event.pull_request.head.repo.fork &&
    (steps.changed.outputs.dockerfile == 'true' || steps.exists.outputs.dockerimage == 'false')
    run: |
    echo 'build=true' >> $GITHUB_OUTPUT

Only other change is a smol output of the Docker name & tag used for any given build to avoid any potential confusion:

- name: Check image name & tag
run: |
echo "NAME: ${{ needs.create-docker-image.outputs.NAME }}"
echo "TAG: ${{ needs.create-docker-image.outputs.TAG }}"

Also been checked as an upstream PR just to make sure it didn't break anything: #151

@antoinevg antoinevg force-pushed the antoinevg/fix-pr-403 branch from 6e1b99a to 9434802 Compare July 30, 2024 16:42
@antoinevg antoinevg force-pushed the antoinevg/fix-pr-403 branch from 9434802 to de35e6b Compare July 30, 2024 16:44
@antoinevg antoinevg marked this pull request as ready for review July 30, 2024 16:54
@antoinevg antoinevg requested a review from martinling July 30, 2024 16:58
@martinling martinling merged commit e27176c into greatscottgadgets:main Jul 30, 2024
10 checks passed
@antoinevg antoinevg deleted the antoinevg/fix-pr-403 branch July 30, 2024 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants