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

Generates a 404 error in npm when attempting to access a repository within a GitHub organization #2447

Open
cmarin001 opened this issue Apr 2, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@cmarin001
Copy link

cmarin001 commented Apr 2, 2024

appreciated how auto streamline the CI/CD process, it's like having a reliable co-pilot that ensures every step of the deployment is executed flawlessly. Their ability to integrate seamlessly, automate testing, and deploy with precision is genuinely impressive. It's not just the efficiency that stands out, but also the peace of mind they provide, knowing that each release meets the highest standards. Truly, autos in CI/CD setups are game-changers, making complex processes feel like a breeze.

I've attempted this configuration because it performed quite well on a personal repository of mine. However, when applied to a repository within a GitHub organization of which I am a member, it fails to work at all.

github action

name: Auto Release

on:
  push:
    branches:
      - main

jobs:
  autorelease:
    runs-on: ubuntu-latest
    if: ${{ !contains(github.event.head_commit.message, 'ci skip') && !contains(github.event.head_commit.message, 'skip ci') }}

    steps:
      - name: Checkout Repository
        uses: actions/checkout@v3
        with:
          token: ${{ secrets.GH_TOKEN }}
          fetch-depth: 0

      - name: Setup Node.js
        uses: actions/setup-node@v3
        with:
          node-version: "20"
          registry-url: "https://registry.npmjs.org/"
          scope: "@mockscope"
          always-auth: true

      - name: Configure Git
        run: |
          git config --global user.email [email protected]
          git config --global user.name YourUsername

      - name: Configure npm
        run: |
          echo "@mockscope:registry=https://registry.npmjs.org/" >> .npmrc
          echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> .npmrc

      - name: Install Dependencies
        run: npm install

      - name: Run auto shipit
        run: npx auto shipit
        env:
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

.autorc.json

{
  "plugins": [
    "git-tag",
    [
      "npm",
      {
        "setRcToken": true,
        "publishFlags": ["--access", "public"]
      }
    ]
  ],
  "owner": "example-owner",
  "repo": "example-repo",
  "name": "example-name",
  "email": "[email protected]"
}

BTW I have altered the sensitive information for privacy reasons, but rest assured, the configuration contains the correct details

And whenever I try this, this issue occurs.

image

I generated the automation token on npm and also tried creating a GH_TOKEN with full permissions, but unfortunately, neither approach was successful

@cmarin001 cmarin001 added the bug Something isn't working label Apr 2, 2024
@hipstersmoothie
Copy link
Collaborator

I would for sure switch out the secrets.GITHUB_TOKEN with a GH_TOKEN that has repo permissions

You are publishing to a scope so I think you have to add something like this

chrmod added a commit to remusao/mono that referenced this issue Jul 11, 2024
chrmod added a commit to remusao/mono that referenced this issue Jul 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants