-
Notifications
You must be signed in to change notification settings - Fork 0
github-action-auto-version #187
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
base: main
Are you sure you want to change the base?
Conversation
- added auto-version workflow to automate executing of `auto_version` to update updated packages' tag
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a new GitHub Actions workflow to automatically version packages when Go code changes are pushed to the main branch. The workflow runs an auto_version script to update package tags based on detected changes.
- Adds automated versioning triggered by changes to Go files, go.mod, or go.sum
- Configures Git credentials for the GitHub Actions bot to create and push tags
- Includes verification step to display the latest created tags
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | ||
|
|
||
| - name: Run auto_version script | ||
| run: | |
Copilot
AI
Aug 29, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The workflow assumes the auto_version script exists and is executable, but there's no error handling if the script doesn't exist or fails. Consider adding error checking or using set -e to ensure the workflow fails appropriately if the script encounters issues.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think should be okay since the file is also committed in the repo so it will always be present? 🤔
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 # Fetch all history for tags | ||
| token: ${{ secrets.GITHUB_TOKEN }} |
Copilot
AI
Aug 29, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using the default GITHUB_TOKEN may not have sufficient permissions to push tags to protected branches or bypass branch protection rules. Consider using a personal access token or GitHub App token with appropriate permissions if the repository has branch protection enabled.
| token: ${{ secrets.GITHUB_TOKEN }} | |
| token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good point, what are our branch protection rules for this repo? likely will fail due to requiring a PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also dunno 🤣
Maybe @lei-wego has some idea? But I see from our other(like payments web component) github workflow we only use GITHUB_TOKEN
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
payments web component actually used to use something called deploy keys, with a custom branch rule to allow deploy keys to bypass.
I've since made changes to the payments web component workflow files but haven't had a chance to test the new flow yet.
| @@ -0,0 +1,41 @@ | |||
| name: Auto Version Packages | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
generated by AI
- added workflow_dispatch to specify the version
- removed auto workflow trigger event
.github/workflows/auto-version.yml
Outdated
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For security reasons we should use the commit hash of the tag
Latest v4 is 4.3.0
| uses: actions/checkout@v4 | |
| uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 |
Or we can try using the recently released v5?
https://github.com/actions/checkout/releases/tag/v5.0.0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will update, I think can use what we are currently using, which is v4
- updated actions/checkout to specific version
auto_versionto update updated packages' tag