Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

repositoryUrl option must a valid GitHub URL #107

Open
chrisminton opened this issue May 5, 2022 · 0 comments
Open

repositoryUrl option must a valid GitHub URL #107

chrisminton opened this issue May 5, 2022 · 0 comments

Comments

@chrisminton
Copy link

chrisminton commented May 5, 2022

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/checkout@v3.0.0 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/checkout@v3.0.0' (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/checkout@v3.0.0
        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: actions/checkout#766

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant