semantic-release-action icon indicating copy to clipboard operation
semantic-release-action copied to clipboard

repositoryUrl option must a valid GitHub URL

Open chrisminton opened this issue 2 years ago • 0 comments

Describe the bug Using latest actions/checkout@v3 (v3.0.2) on self-hosted runners when including @semantic-release/github causes the following error

EINVALIDGITHUBURL The git repository URL is not a valid GitHub URL.
The semantic-release repositoryUrl option must a valid GitHub URL with the format <GitHub_or_GHE_URL>/<owner>/<repo>.git.

By default the repositoryUrl option is retrieved from the repository property of your package.json or the git origin url (https://git-scm.com/book/en/v2/Git-Basics-Working-with-Remotes) of the repository cloned by your CI environment.

[semantic-release] › ✖  An error occurred while running semantic-release: TypeError: Cannot read properties of undefined (reading 'name')

This can be mitigated by using actions/[email protected] and adding

git config --global --add safe.directory </runner/directory/to/repository>

to the action run

Workflow If applicable, provide a workflow file to help explain your problem.

jobs:
  release:
    container: public.ecr.aws/lts/ubuntu:latest
    name: Release
    runs-on:
      - self-hosted
      - ec2
      - ci
    steps:
      - name: Install git
        run: |
          apt update
          apt install -y git

      - name: Checkout
        uses: actions/checkout@v3
        with:
          persist-credentials: false

      - name: Setup NodeJS
        uses: actions/setup-node@v3
        with:
          node-version: "16"

      - name: Install Slack plugin
        run: npm install semantic-release-slack-bot -D

      - name: Semantic Release
        uses: cycjimmy/semantic-release-action@v3
        with:
          extra_plugins: |
            @semantic-release/exec
            @semantic-release/git
            semantic-release-slack-bot

releaserc.yml:

plugins:
  - "@semantic-release/commit-analyzer"
  - "@semantic-release/release-notes-generator"
  - "@semantic-release/github"
  - "@semantic-release/git"
  - - "semantic-release-slack-bot"

Expected behavior The use of latest actions/checkout@v3 should not cause the failure to accept repository path.

Additional context Failing release had these components:

Current runner version: '2.291.1'

Secret source: Actions
Download action repository 'actions/checkout@v3' (SHA:2541b1294d2704b0964813337f33b291d3f8596b)
Download action repository 'actions/setup-node@v3' (SHA:56337c425554a6be30cdef71bf441f15be286854)
Download action repository 'cycjimmy/semantic-release-action@v3' (SHA:3b88c82b34098e8b51e401c1082c9170b0a3ec3c)
Running semantic-release version 19.0.2

successful:

Current runner version: '2.291.1'
Secret source: Actions
Download action repository 'actions/[email protected]' (SHA:a12a3943b4bdde767164f792f33f40b04645d846)
Download action repository 'actions/setup-node@v3' (SHA:56337c425554a6be30cdef71bf441f15be286854)
Download action repository 'cycjimmy/semantic-release-action@v3' (SHA:3b88c82b34098e8b51e401c1082c9170b0a3ec3c)

the fix for this for me was:

jobs:
  release:
    container: public.ecr.aws/lts/ubuntu:latest
    name: Release
    runs-on:
      - self-hosted
      - ec2
      - ci
    steps:
      - name: Install git
        run: |
          apt update
          apt install -y git
+         git config --global --add safe.directory /path/to/repo

      - name: Checkout
-       uses: actions/checkout@v3
+       uses: actions/[email protected]
        with:
          persist-credentials: false

      - name: Setup NodeJS
        uses: actions/setup-node@v3
        with:
          node-version: "16"

      - name: Install Slack plugin
        run: npm install semantic-release-slack-bot -D

      - name: Semantic Release
        uses: cycjimmy/semantic-release-action@v3
        with:
          extra_plugins: |
            @semantic-release/exec
            @semantic-release/git
            semantic-release-slack-bot

The above git config comes from this issue: https://github.com/actions/checkout/issues/766

chrisminton avatar May 05 '22 10:05 chrisminton