actions-template-sync: [Bug]: 2.5.0 break existing behavior
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
Release https://github.com/AndreasAugustin/actions-template-sync/releases/tag/v2.5.0 removes github-token input, as result all my sync workflows require individual update to use source_gh_token which kills the purpose of having this sync worklfow
Expected Behavior
Expected to v2 work without breaking changes
Current Behavior
Warning: Input 'github_token' has been deprecated with message: please use source_gh_token instead to have a declarative name
Run AndreasAugustin/actions-template-sync@v2
Run /home/runner/work/_actions/AndreasAugustin/actions-template-sync/v2/src/entrypoint.sh
git init
ssh setup
::info::prechecks passed
::info::current git hash: 20171d6c63c602f363cefd3842eca566c799335e
::info::variables done
::info::no steps provided. Default is to execute all.
::info::prechecks
prechecks
::info::checkout branch and pull
checkout branch and pull
login target github
::info::target server url: github.com
::info::logging out of the target if logged in
no accounts matched that criteria
::info::login to the target git repository
The value of the GITHUB_TOKEN environment variable is being used for authentication.
To have GitHub CLI store credentials instead, first clear the value from the environment.
Steps To Reproduce
Workflow file
name: Synchronize with upstream template
on:
# cronjob trigger At 00:00 on day-of-month 1 in every 2nd month.
schedule:
- cron: '0 0 1 */2 *' # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#onschedule
# manual trigger
workflow_dispatch:
jobs:
sync:
runs-on: ubuntu-latest
timeout-minutes: 2
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.WORKFLOW_PAT }} # PAT with permissions to modify github actions workflows
- name: actions-template-sync
uses: AndreasAugustin/actions-template-sync@v2
with:
github_token: ${{ github.token }}
upstream_branch: main # defaults to main
source_repo_ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }} # github token from context not able to pull source repository in another private repo. We use private key to access source repo via SSH protocol
pr_branch_name_prefix: fix/template_sync
pr_title: 'fix: sync with parent template'
pr_labels: 'enhancement'
Possible Solution
Either make it non-breaking change, or bump major version instead to v3
Additional Information/Context
No response
Template sync version Version
AndreasAugustin/actions-template-sync@v2
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 16 (8 by maintainers)
Commits related to this issue
- fix(#608): issue with GITHUB_TOKEN env variable Signed-off-by: Andy Augustin <dev@andreas-augustin.org> — committed to AndreasAugustin/actions-template-sync by AndreasAugustin 2 years ago
- fix(#608): workaround Signed-off-by: Andy Augustin <dev@andreas-augustin.org> — committed to AndreasAugustin/actions-template-sync by AndreasAugustin 2 years ago
- fix(#608): workaround (#614) * fix(#608): issue with GITHUB_TOKEN env variable Signed-off-by: Andy Augustin <dev@andreas-augustin.org> * fix(#608): workaround Signed-off-by: Andy Augustin <dev@and... — committed to AndreasAugustin/actions-template-sync by AndreasAugustin 2 years ago
@ahanoff I highly recommend to also fix the issue on your side (hints are given above). Only one major version will be maintained. So if an issue within v2 appears and v3 is out, most likely v2 will not be fixed.
I will try and update if it’s working. Problem is I have like ~50 repos to update 😄
thanks for the clarification. Totally valid use case and I totally forgot about the need for PAT to modify the workflow files.
Remark Actually this is not an issue with the mentioned
warningin the statement. Thegithub_tokeninput is still working. But there has been a change for thetarget_github_token. It implicitly was using theGITHUB_TOKENenv variable which was set by the checkout workflow. This was actually breaking other use cases (and was a bug).For a fast workaround on your side using smth like (yes currently breaking but not sure about a fast solution)
should do the trick. You can remove that part from the checkout step and use the workflow token (optional).
This issue is most likely not that easy to solve. Need to think about it.
Hello @ahanoff and thanks for your bug report. The mentioned Unit test is most likely another issue not related permission issue. Please link a failing unit test related the PR itself (if available, will also check later but out of my memory the PR unit tests did not fail).
Please also share your error message and the error. The warning is on purpose because the variable will be removed with next major upgrade so that people can already migrate but the old variable input should still work. (But possibly the warning message could include a sentence that it will be removed with next major version)