Fix auto-version workflow not triggering other workflows on tag push#48
Merged
Conversation
Co-authored-by: RafaelJohn9 <125447154+RafaelJohn9@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] [Bug]: auto-version workflow not triggering other neccessary workflows on push of version tags
Fix auto-version workflow not triggering other workflows on tag push
Jul 2, 2025
RafaelJohn9
requested changes
Jul 2, 2025
Comment on lines
+161
to
+178
|
|
||
| ## Troubleshooting | ||
|
|
||
| ### Workflow Issues | ||
|
|
||
| If you're experiencing issues with GitHub Actions workflows not triggering properly, see our [Workflow Troubleshooting Guide](docs/WORKFLOW_TROUBLESHOOTING.md) for common solutions. | ||
|
|
||
| **Common Issues:** | ||
| - Auto-version workflow not triggering build/release workflows | ||
| - Workflows not chaining properly after tag pushes | ||
| - Token configuration problems | ||
|
|
||
| ### General Support | ||
|
|
||
| If you encounter any issues or have questions: | ||
| 1. Check the [troubleshooting documentation](docs/WORKFLOW_TROUBLESHOOTING.md) | ||
| 2. Search existing [issues](https://github.com/RafaelJohn9/gh-templates/issues) | ||
| 3. Open a new issue with details about your problem |
Member
There was a problem hiding this comment.
let's not update README for now
Contributor
Author
There was a problem hiding this comment.
README troubleshooting section has been removed as requested. The file has been reverted to its original state. 584e28d
Comment on lines
+1
to
+75
| # Workflow Troubleshooting Guide | ||
|
|
||
| ## Auto-Version Workflow Not Triggering Other Workflows | ||
|
|
||
| ### Problem | ||
| The auto-version workflow creates and pushes version tags, but other workflows (`build.yml`, `update_changelog.yml`, `update-readme-version.yml`) are not being triggered by these tag pushes. | ||
|
|
||
| ### Root Cause | ||
| GitHub Actions has a security feature where workflows triggered by the default `GITHUB_TOKEN` cannot trigger other workflows. This prevents infinite loops but also prevents legitimate workflow chaining. | ||
|
|
||
| ### Solution | ||
| Configure a Personal Access Token (PAT) to allow the auto-version workflow to trigger other workflows. | ||
|
|
||
| #### Step 1: Create a Personal Access Token | ||
| 1. Go to GitHub Settings → Developer settings → Personal access tokens → Tokens (classic) | ||
| 2. Click "Generate new token (classic)" | ||
| 3. Set the following permissions: | ||
| - `contents:write` - Required to push tags | ||
| - `actions:write` - Required to trigger other workflows | ||
| - `metadata:read` - Required for basic repository access | ||
| 4. Copy the generated token | ||
|
|
||
| #### Step 2: Add Token to Repository Secrets | ||
| 1. Go to your repository → Settings → Secrets and variables → Actions | ||
| 2. Click "New repository secret" | ||
| 3. Name: `PAT_TOKEN` | ||
| 4. Value: Paste the token from Step 1 | ||
| 5. Click "Add secret" | ||
|
|
||
| #### Step 3: Verify Configuration | ||
| After adding the `PAT_TOKEN` secret: | ||
| 1. Push a commit to the main branch | ||
| 2. Check the auto-version workflow logs - you should see "✅ PAT_TOKEN is configured" | ||
| 3. The workflow should create a new version tag | ||
| 4. Other workflows should be triggered by the tag push | ||
|
|
||
| ### Verification | ||
| You can verify the fix is working by: | ||
| 1. Checking that the auto-version workflow shows "PAT_TOKEN is configured" in the logs | ||
| 2. Confirming that when a tag is pushed, the following workflows are triggered: | ||
| - `build.yml` (Release workflow) | ||
| - `update_changelog.yml` (Update CHANGELOG) | ||
| - `update-readme-version.yml` (Update README Version) | ||
|
|
||
| ### Fallback Behavior | ||
| If `PAT_TOKEN` is not configured, the workflow will: | ||
| - Still function and create version tags | ||
| - Use the default `GITHUB_TOKEN` | ||
| - Show a warning that other workflows won't be triggered | ||
| - Provide instructions on how to fix the configuration | ||
|
|
||
| ### Security Considerations | ||
| - The PAT should have minimal required permissions (`contents:write`, `actions:write`, `metadata:read`) | ||
| - Store the PAT as a repository secret, never commit it to code | ||
| - Consider using a GitHub App token instead of a PAT for organization-wide setups | ||
| - Regularly rotate the PAT according to your security policies | ||
|
|
||
| ## Alternative Solutions | ||
|
|
||
| ### GitHub App Token | ||
| For more advanced setups, you can use a GitHub App token instead of a PAT: | ||
| 1. Create a GitHub App with the required permissions | ||
| 2. Install the app on your repository | ||
| 3. Use the `actions/create-github-app-token` action to generate a token | ||
| 4. Replace `PAT_TOKEN` usage with the app token | ||
|
|
||
| ### Manual Workflow Triggers | ||
| If you prefer not to use tokens, you can manually trigger dependent workflows: | ||
| 1. Remove automatic triggers from dependent workflows | ||
| 2. Add `workflow_dispatch` triggers | ||
| 3. Use the GitHub API to manually trigger workflows after tag creation | ||
|
|
||
| ## Related Issues | ||
| - [GitHub Actions Documentation: Triggering a workflow from a workflow](https://docs.github.com/en/actions/using-workflows/triggering-a-workflow#triggering-a-workflow-from-a-workflow) | ||
| - This addresses the issue described in the repository's issue tracker regarding workflow chaining No newline at end of file |
Member
There was a problem hiding this comment.
let's not add any documentation for this issue for now
Contributor
Author
There was a problem hiding this comment.
Documentation file has been removed as requested. The docs/WORKFLOW_TROUBLESHOOTING.md file has been deleted. 584e28d
Member
Co-authored-by: RafaelJohn9 <125447154+RafaelJohn9@users.noreply.github.com>
RafaelJohn9
approved these changes
Jul 2, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The auto-version workflow creates and pushes version tags successfully, but other workflows (
build.yml,update_changelog.yml,update-readme-version.yml) are not being triggered by these tag pushes.Root Cause
GitHub Actions has a security feature where workflows triggered by the default
GITHUB_TOKENcannot trigger other workflows to prevent infinite loops. The auto-version workflow was usingGITHUB_TOKENfor git operations, preventing workflow chaining.Solution
Updated the auto-version workflow to support Personal Access Token (PAT) configuration while maintaining backward compatibility:
Key Changes
Token Configuration with Fallback:
User-Friendly Configuration Checking:
Comprehensive Documentation:
docs/WORKFLOW_TROUBLESHOOTING.mdwith step-by-step PAT setup instructionsBackward Compatibility
Setup Instructions
To enable workflow triggering:
contents:writeandactions:writepermissionsPAT_TOKENrepository secretVerification
The fix provides clear user guidance while maintaining full backward compatibility, ensuring users can easily resolve the workflow chaining issue when ready.
Fixes #47.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.