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

Commit SHA in pull request event is incorrect. #414

Closed
3 tasks done
iwata opened this issue May 15, 2024 · 1 comment
Closed
3 tasks done

Commit SHA in pull request event is incorrect. #414

iwata opened this issue May 15, 2024 · 1 comment

Comments

@iwata
Copy link

iwata commented May 15, 2024

Contributing guidelines

I've found a bug, and:

  • The documentation does not mention anything about my problem
  • There are no open or closed issues that are related to my problem

Description

I'm using type=ref,event=pr,suffix=-{{sha}} as tags option. But sha is incorrect.

Expected behaviour

sha returns github.event.pull_request.head.sha.

Actual behaviour

sha returns github.sha.

Repository URL

No response

Workflow run URL

No response

YAML workflow

      - name: Docker meta
        id: meta
        uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1
        with:
          images: app
          tags: |
            type=ref,event=pr,suffix=-{{sha}}
      - name: debug
        run: |
          echo ${{ steps.meta.outputs.tags }}
          git rev-parse --short ${{ github.event.pull_request.head.sha }}
          git rev-parse --short "$GITHUB_SHA"

Workflow logs

pr-xxxx-937f26e
f03bb03
937f26e

BuildKit logs

No response

Additional info

No response

@crazy-max
Copy link
Member

You need to set DOCKER_METADATA_PR_HEAD_SHA: true env var: https://github.com/docker/metadata-action?tab=readme-ov-file#environment-variables

tpendragon added a commit to pulibrary/dpul-collections that referenced this issue May 30, 2024
tpendragon added a commit to pulibrary/dpul-collections that referenced this issue May 30, 2024
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

No branches or pull requests

2 participants