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

feat(github-actions): Change behavior to not add "renovate" to inline yaml comments when pinning #14110

Merged

Conversation

soenkeliebau
Copy link
Contributor

Changes:

When Renovate pins docker hashes for github actions it adds an inline comment to the lines to specify which version of the action this hash refers to.

Currently the lines will look like this:
- uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # renovate: tag=v2.4.0

after this change, any newly written lines will look like this:
- uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # tag=v2.4.0

Existing lines will not be changed, but still be correctly parsed and written in the new format when they are next updated.

I have also slightly changed the Regex used to parse these strings to be more generous with extra whitespaces. In its current form the regex would tolerate extra whitespaces before the comment, but it seems like this is more or less accidental as they would be added to the currentValue capture group (and then probably stripped or trimmed somewhere, but why take the risk?).

Context:

Closes #14105

Documentation (please check one with an [x])

  • I have updated the documentation, or
  • No documentation update is required

How I've tested my work (please tick one)

I have verified these changes via:

  • Code inspection only, or
  • Newly added/modified unit tests, or
  • No unit tests but ran on a real repository, or
  • Both unit tests + ran on a real repository

…nned docker versions in Github actions files.

Currently the lines will look like this:
 `- uses: actions/checkout@ec3a7ce # renovate: tag=v2.4.0`

after this change, any newly written lines will look like this:
 `- uses: actions/checkout@ec3a7ce # renovate: tag=v2.4.0`

Existing comments will not be changed, but still be correctly parsed.

I have also slightly changed the Regex used to parse these strings to be more generous with extra whitespaces.

Closes renovatebot#14105
@soenkeliebau soenkeliebau changed the title Changes behavior to not add "renovate" to inline yaml comments when pinning github actions feat(manager/github-actions) Change behavior to not add "renovate" to inline yaml comments when pinning github actions Feb 9, 2022
@rarkins rarkins changed the title feat(manager/github-actions) Change behavior to not add "renovate" to inline yaml comments when pinning github actions feat(github-actions): Change behavior to not add "renovate" to inline yaml comments when pinning Feb 9, 2022
Copy link
Collaborator

@rarkins rarkins left a comment

Choose a reason for hiding this comment

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

Can we test this on a live first? Need a few use cases:

  • Unpinned -> pinned
  • Pinned with renovate comment -> pinned without renovate comment
  • Pinned without renovate comment (new style) -> retain new style

@soenkeliebau
Copy link
Contributor Author

I've rigged a very quick test here:

https://github.com/soenkeliebau/renovate-test/pulls

Happy to create additional checks - also happy to merge a pr if you want to create some scenarios.

@rarkins
Copy link
Collaborator

rarkins commented Feb 9, 2022

@soenkeliebau looking good.. can you reproduce the scenario where it "pins" the action? I think you'll need an unpinned action with version, plus pinDigests enabled

@soenkeliebau
Copy link
Contributor Author

@soenkeliebau looking good.. can you reproduce the scenario where it "pins" the action? I think you'll need an unpinned action with version, plus pinDigests enabled

Sorry, should have mentioned that, I did that to get a baseline for those PRs. This commit: soenkeliebau/renovate-test@a396546 was generated by Renovate.
Or well... to be precise, Renovate generated the branch, I created the PR because I had renovate configured wrong and it didn't create the PR itself.

@rarkins rarkins merged commit 5d419a1 into renovatebot:main Feb 9, 2022
@soenkeliebau soenkeliebau deleted the fix/14105-drop-renovate-from-comments branch February 9, 2022 15:49
@renovate-release
Copy link
Collaborator

🎉 This PR is included in version 31.72.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Drop renovate: prefix for pinned GitHub Action dependencies
4 participants