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

Change generated file headers to include GitHub link instead of version #894

Merged
merged 8 commits into from Apr 9, 2024

Conversation

ubergesundheit
Copy link
Member

@ubergesundheit ubergesundheit commented Apr 3, 2024

This PR changes the header of generated files to contain a GitHub link instead of the devctl version.

Follow up of #875

Example:

# DO NOT EDIT. Generated with:
#
#    devctl
#
#    https://github.com/giantswarm/devctl/blob/6a704f7e2a8b0f09e82b5bab88f17971af849711/pkg/gen/input/makefile/internal/file/Makefile.template
#

The URL points to the template on GitHub using the latest commit the template was changed.

IMO this helps in multiple ways:

  • One can use the blame feature to see when a specific line in the template was changed and why (browsing history of the template at the source)
  • In case a template needs to be changed, its easier to find the exact file to change

The changes in this PR can be tested by using the container image like this:

docker run --rm -it -v $(pwd):/app -w /app \
  quay.io/giantswarm/devctl:6.23.3-784664fc1434a6494500bc0eff8bee9e8d4bebfa \
  gen workflows -l go -f cli

/cc @lyind @marians as you were involved in the last PR

Checklist

  • Update changelog in CHANGELOG.md.

@ubergesundheit ubergesundheit requested a review from a team April 3, 2024 14:06
@ubergesundheit ubergesundheit requested a review from a team April 3, 2024 15:12
@ubergesundheit ubergesundheit marked this pull request as ready for review April 3, 2024 15:12
@ubergesundheit ubergesundheit requested a review from a team as a code owner April 3, 2024 15:12
@marians
Copy link
Member

marians commented Apr 3, 2024

OK, first of all, it seems kind of cool!

Am I right assuming that the URL like https://github.com/giantswarm/devctl/blob/6a704f7e2a8b0f09e82b5bab88f17971af849711/pkg/gen/input/makefile/internal/file/Makefile.template always represents the last commit that modified the template? So there will be no PRs which only update the header?

I am just not exactly sure how useful that URL with a git commit is.

@ubergesundheit
Copy link
Member Author

Yes, the URL points to the template on GitHub using the latest commit the template was changed.

IMO this helps in multiple ways:

  • One can use the blame feature to see when a specific line in the template was changed and why (browsing history of the template at the source)
  • In case a template needs to be changed, its easier to find the exact file to change

Copy link
Member

@marians marians left a comment

Choose a reason for hiding this comment

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

OK, fair enough! Let's try it out.

Copy link
Contributor

@lyind lyind left a comment

Choose a reason for hiding this comment

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

𝕃𝔾𝕋𝕄

Only minor suggestion in Changelog (spelling)

CHANGELOG.md Outdated Show resolved Hide resolved
@ubergesundheit ubergesundheit enabled auto-merge (squash) April 9, 2024 13:24
@ubergesundheit ubergesundheit merged commit 4668d94 into main Apr 9, 2024
1 of 2 checks passed
@ubergesundheit ubergesundheit deleted the change-files-headers branch April 9, 2024 13:26
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.

None yet

3 participants