There are three issues with the use of the action cycjimmy/semantic-release-action in GHA's main action.
The first two minor issues affect how it runs in the parent repository cypress-io/github-action. The third issue concerns the failure to run in a fork when actions are enabled. This is annoying, as it should not try to run in a fork.
Workflow location
.github/workflows/main.yml
Issue 1 - GitHub deprecation warnings
When main.yml executes on GitHub, two deprecation warnings are output - see run 3687891754:
"Node.js 12 actions are deprecated. For more information see: https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/. Please update the following actions to use Node.js 16: cycjimmy/semantic-release-action@v2"
"The set-output command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/"
Issue 2 - parameter branch
The action cycjimmy/semantic-release-action's README: Inputs lists the parameters branches and branch as follows:
| Input Parameter |
Required |
Description |
| branches |
false |
The branches on which releases should happen.[Details] Support for semantic-release above v16. |
| branch |
false |
The branch on which releases should happen.[Details] Only support for semantic-release older than v16. |
Logs show "ℹ Running semantic-release version 19.0.5" which is newer that semantic-release v16 (see above), so the input parameter branch is not correct.
Issue 3 - failure in fork
When main.yml executes on a GitHub fork, it fails with an Annotations error:
"SemanticReleaseError: Cannot push to the Git repository."
In detail "The command "git push --dry-run --no-verify https://x-access-token:[secure]@github.com/cypress-io/github-action.git HEAD:master" fails with the error message remote: Permission to cypress-io/github-action.git denied to github-actions[bot]."
Instead of failing it should skip trying to run on a fork.
Suggestions
Bump cycjimmy/semantic-release-action to v3
In cycjimmy/semantic-release-action the deprecation issues were resolved in v3.0.0 and in v3.1.2 respectively, so the minimum version needed is v3.1.2. v3 is currently at v3.2.0
|
uses: cycjimmy/semantic-release-action@v2 |
Update uses: cycjimmy/semantic-release-action@v2 to @v3
Change cycjimmy/semantic-release-action parameter to branches
Change branch: master to branches: master.
Prevent cycjimmy/semantic-release-action running in fork
|
if: github.ref == 'refs/heads/master' |
Add if condition to ensure it only tries to release when it is running on cypress-io/github-action. See Example: Only run job for specific repository.
For instance, consider adding:
if: github.repository == 'cypress-io/github-action'
There are three issues with the use of the action cycjimmy/semantic-release-action in GHA's main action.
The first two minor issues affect how it runs in the parent repository cypress-io/github-action. The third issue concerns the failure to run in a fork when actions are enabled. This is annoying, as it should not try to run in a fork.
Workflow location
.github/workflows/main.yml
Issue 1 - GitHub deprecation warnings
When main.yml executes on GitHub, two deprecation warnings are output - see run 3687891754:
"Node.js 12 actions are deprecated. For more information see: https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/. Please update the following actions to use Node.js 16: cycjimmy/semantic-release-action@v2"
"The
set-outputcommand is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/"Issue 2 - parameter
branchThe action cycjimmy/semantic-release-action's README: Inputs lists the parameters
branchesandbranchas follows:Support for semantic-release above v16.
Only support for semantic-release older than v16.
Logs show "ℹ Running semantic-release version 19.0.5" which is newer that semantic-release v16 (see above), so the input parameter
branchis not correct.github-action/.github/workflows/main.yml
Line 43 in 57031a3
Issue 3 - failure in fork
When main.yml executes on a GitHub fork, it fails with an Annotations error:
"SemanticReleaseError: Cannot push to the Git repository."
In detail "The command "git push --dry-run --no-verify https://x-access-token:[secure]@github.com/cypress-io/github-action.git HEAD:master" fails with the error message remote: Permission to cypress-io/github-action.git denied to github-actions[bot]."
Instead of failing it should skip trying to run on a fork.
Suggestions
Bump cycjimmy/semantic-release-action to v3
In cycjimmy/semantic-release-action the deprecation issues were resolved in v3.0.0 and in v3.1.2 respectively, so the minimum version needed is v3.1.2.
v3is currently at v3.2.0github-action/.github/workflows/main.yml
Line 40 in 57031a3
Update
uses: cycjimmy/semantic-release-action@v2to@v3Change cycjimmy/semantic-release-action parameter to branches
Change
branch: mastertobranches: master.Prevent cycjimmy/semantic-release-action running in fork
github-action/.github/workflows/main.yml
Line 33 in 57031a3
Add
ifcondition to ensure it only tries to release when it is running on cypress-io/github-action. See Example: Only run job for specific repository.For instance, consider adding: