Skip to content

feature request: look up a hash by version #83

Description

@lucasgonze

Pinning by hash createst UI friction. With a tool like yarn a developer can use the CLI to look up the hash and upgrade the yaml in a terse command - yarn upgrade foopackage@1.2.3. With pin-github-action the developer has to find the repo, look up the tag of the version they want, copy the hash, and paste the hash into their yaml.

pin-github-action should either:

  1. Be able to upgrade a single dependency using a command similar to yarn
  2. Be able to look up the hash in the CLI, so they can upgrade the yaml by hand

Activity

  1. lucasgonze commented on Jun 17, 2022

    @lucasgonze
    ContributorAuthor

    If you are in agreement with this feature, I am willing to submit a PR implementing it.

  2. mheap commented on Jun 20, 2022

    @mheap
    Owner

    @lucasgonze I'm not sure what you're suggesting we implement here. Are you looking for a way to specify a specific version of a dependency, or to update the hash in a workflow for an existing pinned dependency?

  3. lucasgonze commented on Jun 20, 2022

    @lucasgonze
    ContributorAuthor

    Let's say you have this:

    uses: DoozyX/clang-format-lint-action@9ea72631b74e61ce337d0839a90e76180e997283 # pin@v0.13

    and there exists a 0.14 with hash 1234567.

    You issue this command:

    node bin.js --update DoozyX/clang-format-lint-action@v0.14

    Then the yaml file changes to:

    uses: DoozyX/clang-format-lint-action@1234567 # pin@v0.14

    As a simplification, the CLI might simply report on the hash at a given version, in order to save the work of looking up the tag on Github. So this command:

    node bin.js --lookup DoozyX/clang-format-lint-action@v0.14

    Would return this in the shell:

    1234567

  4. mheap commented on Jun 20, 2022

    @mheap
    Owner

    Thanks for the examples, it makes it much clearer.

    What are the benefits of adding support for node bin.js --update DoozyX/clang-format-lint-action@v0.14 in addition to updating the YAML to uses: DoozyX/clang-format-lint-action@v0.14 then re-running bin.js? This would look up the hash for the new version provided (or you could update pin@v0.13 to pin@v0.14 and re-run bin.js and it would update the hash too

  5. lucasgonze commented on Jun 20, 2022

    @lucasgonze
    ContributorAuthor

    My intention with this is to avoid modifying hashes apart from the one named in the parameter.

    The reason I would want to only touch the one item is concern that other items might be iterated to a hash that hadn't been vetted, and this would reduce the security of pinning by hash to the same level as pinning by version.

    Am I understanding this right?

  6. mheap commented on Jun 21, 2022

    @mheap
    Owner

    Yep, that's how it would work today.

    We currently have an --allow flag to ignore specific actions from being pinned. Would adding an --only flag enable your use case?

    # Update a single action
    ./bin.js --only  DoozyX/clang-format-lint-action
    
    # Or update everything by a user/org
    ./bin.js --only DoozyX/*
    

    This would pull the latest hash for the version specified in the pin@main comment. If you wanted to manually update the version that you're pinning to, you'd have to update the YAML file.

  7. lucasgonze commented on Jun 21, 2022

    @lucasgonze
    ContributorAuthor

    --only would do the job.

    I also like the "everything by a user/org" idea, because it allows for very trusted orgs like actions/.

  8. lucasgonze commented on Jun 24, 2022

    @lucasgonze
    ContributorAuthor

    FYI: my PR for this feature is not yet ready, but I have submitted a couple other trivial features that became useful during development.

  9. added a commit that references this issue on Jun 24, 2022
  10. zeisss commented on Jul 6, 2023

    @zeisss

    Slightly off-topic, but github's Dependabot can not update github actions pinned by SHA if there is an appropriately formatted comment. See https://github.blog/changelog/2022-10-31-dependabot-now-updates-comments-in-github-actions-workflows-referencing-action-versions/

  11. mheap commented on Mar 19, 2025

    @mheap
    Owner

    I'm going to close this issue as both Dependabot and Renovate can now update actions by submitting PRs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions