Skip to content

Conversation

paddyroddy
Copy link
Member

I've changed github.sha to github.ref_name.

  • github.sha points to the current commit SHA in the workflow
  • github.ref_name will contain the tag name of the release

This ensures the latest tag points to the same commit as the release tag, rather than potentially pointing to a different commit that triggered the workflow. This is especially important if you create releases through the GitHub UI, where you might select an older commit to create the release from.

I've changed `github.sha` to `github.ref_name`.

- `github.sha` points to the current commit SHA in the workflow
- `github.ref_name` will contain the tag name of the release

This ensures the latest tag points to the same commit as the release tag, rather than potentially pointing to a different commit that triggered the workflow. This is especially important if you create releases through the GitHub UI, where you might select an older commit to create the release from.
@paddyroddy paddyroddy added bug Something isn't working enhancement New feature or request labels Oct 22, 2024
@paddyroddy paddyroddy self-assigned this Oct 22, 2024
Copy link
Member

@samcunliffe samcunliffe left a comment

Choose a reason for hiding this comment

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

Fine for me, but I thought SHA would work...

@paddyroddy paddyroddy added the needs-2-reviewers Could be considered "controversial" so worth a second pair of eyes label Oct 22, 2024
@samcunliffe
Copy link
Member

Should we mention the label in the CONTRIBUTING? I'd say probably not... just for the sake getting bogged down.

@paddyroddy
Copy link
Member Author

Fine for me, but I thought SHA would work...

It does, but is ref_name safer?

@paddyroddy
Copy link
Member Author

Should we mention the label in the CONTRIBUTING? I'd say probably not... just for the sake getting bogged down.

Yeah I reckon not worth it

@matt-graham
Copy link
Collaborator

This ensures the latest tag points to the same commit as the release tag, rather than potentially pointing to a different commit that triggered the workflow. This is especially important if you create releases through the GitHub UI, where you might select an older commit to create the release from.

I think in GitHub's terminology 'commit that triggered the workflow' has a meaning which is dependent on the triggering event and for the release event GITHUB_SHA (and I assume therefore github.sha) is always the last commit in the tagged release. So I don't know that there is any risk of these being different at the point the workflow is run? But I guess there is a possibility the tag could be later changed to point to a different commit SHA in which case maybe pointing to the release tag is slightly preferable, though I would say we would probably not want to ever change release tags after the fact.

@paddyroddy
Copy link
Member Author

though I would say we would probably not want to ever change release tags after the fact.

Agreed

Copy link
Collaborator

@matt-graham matt-graham left a comment

Choose a reason for hiding this comment

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

Approving as doesn't seem like there is any downside to this change!

@paddyroddy paddyroddy merged commit c90f185 into main Oct 23, 2024
13 checks passed
@paddyroddy paddyroddy deleted the paddyroddy-patch-1 branch October 23, 2024 07:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request needs-2-reviewers Could be considered "controversial" so worth a second pair of eyes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants