Skip to content

Issues with cycjimmy/semantic-release-action in main workflow #672

@MikeMcC399

Description

@MikeMcC399

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'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions