Skip to content

chore(changelog-check): add action-sha input for correct repository checkout#63

Merged
cryptodev-2s merged 5 commits into
mainfrom
fix/workflow-reference-checkout-2
May 5, 2025
Merged

chore(changelog-check): add action-sha input for correct repository checkout#63
cryptodev-2s merged 5 commits into
mainfrom
fix/workflow-reference-checkout-2

Conversation

@cryptodev-2s
Copy link
Copy Markdown
Contributor

@cryptodev-2s cryptodev-2s commented Apr 23, 2025

Description

This PR adds an action-sha input to the changelog check workflow to ensure we're using the correct version of the github-tools repository. This is necessary because:

  1. When a workflow is called using a specific SHA (e.g., @91e349d177db2c569e03c7aa69d2acb404b62f75), we need to use that exact same SHA when checking out the repository
  2. Previous attempts using github.action_ref, github.sha, or other GitHub context variables didn't work because:
    • github.action_ref includes the full ref path (e.g., +refs/heads/v4*:refs/remotes/origin/v4*)
    • github.sha refers to the current workflow run's SHA
    • Other context variables don't reliably provide the correct SHA

Long-term Plan

This is a short-term fix. In the future, we plan to:

  1. Move the workflow to a separate repository
  2. Implement proper versioning for the tools
  3. Use GitHub Actions' built-in versioning system
  4. Remove the need for manual SHA management

Changes

  • Added new required input action-sha to the workflow
  • Updated the checkout step to use ${{ inputs.action-sha }}
  • This ensures we're using the exact same version that was specified in the workflow call

Testing

  1. This change is being tested in MetaMask/core#5693 where we're updating the changelog check workflow to use the new action-sha input.

  2. Test with a workflow call using a specific SHA:

    uses: MetaMask/github-tools/.github/workflows/changelog-check.yml@91e349d177db2c569e03c7aa69d2acb404b62f75
    with:
      action-sha: 91e349d177db2c569e03c7aa69d2acb404b62f75
      # ... other inputs ...
    • Verify that the workflow successfully checks out the correct SHA
  3. Verify that the checkout works correctly and matches the version used in the workflow call

@cryptodev-2s cryptodev-2s self-assigned this Apr 23, 2025
@cryptodev-2s cryptodev-2s marked this pull request as draft April 23, 2025 09:50
@cryptodev-2s cryptodev-2s force-pushed the fix/workflow-reference-checkout-2 branch from edc4961 to 5af9094 Compare May 5, 2025 20:08
@cryptodev-2s cryptodev-2s changed the title chore(changelog-check): use action_sha instead of action_ref chore(changelog-check): add action-sha input for correct repository checkout May 5, 2025
@cryptodev-2s cryptodev-2s marked this pull request as ready for review May 5, 2025 20:15
Copy link
Copy Markdown
Member

@rekmarks rekmarks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@cryptodev-2s cryptodev-2s merged commit 4e69242 into main May 5, 2025
18 checks passed
@cryptodev-2s cryptodev-2s deleted the fix/workflow-reference-checkout-2 branch May 5, 2025 21:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants