intuit / auto

Generate releases based on semantic version labels on pull requests.
https://intuit.github.io/auto/
MIT License
2.28k stars 205 forks source link

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

Open cmarin001 opened 8 months ago

cmarin001 commented 8 months ago

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 user@example.com
          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": "example-email@example.com"
}

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

hipstersmoothie commented 8 months ago

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