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

Set AUTOBUILD_VCS_BRANCH for an autobuild package. #28

Merged
merged 5 commits into from
Dec 18, 2023
Merged

Conversation

nat-goodspeed
Copy link
Contributor

It's useful to be able to look up the source branch from which a given autobuild package tarball was built. If AUTOBUILD_VCS_BRANCH is set in autobuild's environment, that gets stored in the package's autobuild-package.xml. Without it, every autobuild package's GitHub build's branch is reported as "HEAD".

For a tag build used to release a package, github reports the tag name rather
than the branch to which it corresponds. Look up the corresponding branch and
pass it to autobuild as AUTOBUILD_VCS_BRANCH, which will set the vcs_branch
field in the package's autobuild-package.xml's package_description.

Otherwise, vcs_branch is reported for every build of every package as "HEAD".
@nat-goodspeed nat-goodspeed added the enhancement New feature or request label Dec 15, 2023
Copy link

@brad-linden brad-linden left a comment

Choose a reason for hiding this comment

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

approved with a question

run: |
# in real use, 'git branch -r --contains' should produce a single line,
# but our self-tests can emit more than one
branch="$(git branch -r --contains ${{ steps.sha.outputs.long }} | head -n 1)"

Choose a reason for hiding this comment

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

is there an advantage of this git incantation over git rev-parse --abbrev-ref HEAD which has been the standard one that I've included in my shell prompt since time immemorial?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Likely to report detached HEAD. git branch --contains <hash> reports detached HEAD unless you also supply -r.

@nat-goodspeed nat-goodspeed merged commit 3905538 into main Dec 18, 2023
3 checks passed
@nat-goodspeed nat-goodspeed deleted the which-branch branch December 18, 2023 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants