Skip to content

[BUG] Publishing another version with OIDC fails to find an earlier published version of a scoped package #8678

Closed
aptos-labs/aptos-client
#18

Description

@prantlf

Is there an existing issue for this?

  • I have searched the existing issues

This issue exists in the latest npm version

  • I am using the latest npm

Current Behavior

I enabled trusted publishing with OICD for the NPM package @mockfetch/mockfetch and GitHub repo prantlf/mockfetch.git. Running npm publish --access public --verbose failed.

At first, the publishing permission was granted:

npm http fetch GET https://run-actions-3-azure-eastus.actions.githubusercontent.com/61//idtoken/***/***?api-version=2.0&audience=npm%3Aregistry.npmjs.org 200 82ms

Then an error occurred:

npm http fetch POST 404 https://registry.npmjs.org/-/npm/v1/oidc/token/exchange/package/@mockfetch%2fmockfetch 574ms
npm verbose oidc Failed token exchange request with body message: OIDC token exchange error - package not found

Publishing continued by successful fetching the current version of the package:

npm http fetch GET 200 https://registry.npmjs.org/@mockfetch%2fmockfetch 709ms (cache miss)
npm notice Publishing to https://registry.npmjs.org/ with tag latest and public access

Eventually a fatal error occurred:

npm http fetch PUT 404 https://registry.npmjs.org/@mockfetch%2fmockfetch 159ms
npm verbose stack HttpErrorGeneral: 404 Not Found - PUT https://registry.npmjs.org/@mockfetch%2fmockfetch - Not found
npm verbose stack     at /opt/hostedtoolcache/node/24.10.0/x64/lib/node_modules/npm/node_modules/npm-registry-fetch/lib/check-response.js:103:15
npm verbose stack     at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
npm verbose stack     at async publish (/opt/hostedtoolcache/node/24.10.0/x64/lib/node_modules/npm/node_modules/libnpmpublish/lib/publish.js:53:15)
npm verbose stack     at async otplease (/opt/hostedtoolcache/node/24.10.0/x64/lib/node_modules/npm/lib/utils/auth.js:8:12)
npm verbose stack     at async #publish (/opt/hostedtoolcache/node/24.10.0/x64/lib/node_modules/npm/lib/commands/publish.js:188:7)
npm verbose stack     at async Publish.exec (/opt/hostedtoolcache/node/24.10.0/x64/lib/node_modules/npm/lib/commands/publish.js:47:5)
npm verbose stack     at async Npm.exec (/opt/hostedtoolcache/node/24.10.0/x64/lib/node_modules/npm/lib/npm.js:208:9)
npm verbose stack     at async module.exports (/opt/hostedtoolcache/node/24.10.0/x64/lib/node_modules/npm/lib/cli/entry.js:67:5)
npm verbose statusCode 404
npm verbose pkgid @mockfetch/[email protected]
npm error code E404
npm error 404 Not Found - PUT https://registry.npmjs.org/@mockfetch%2fmockfetch - Not found
npm error 404
npm error 404  The requested resource '@mockfetch/[email protected]' could not be found or you do not have permission to access it.

Can it be that the "package not found" error was caused by the scoped package?

The full log:

Run npm publish --access public --verbose
  npm publish --access public --verbose
  shell: /usr/bin/bash -e {0}
  env:
    PNPM_HOME: /home/runner/setup-pnpm/node_modules/.bin
    NPM_CONFIG_USERCONFIG: /home/runner/work/_temp/.npmrc
    NODE_AUTH_TOKEN: XXXXX-XXXXX-XXXXX-XXXXX
npm verbose cli /opt/hostedtoolcache/node/24.10.0/x64/bin/node /opt/hostedtoolcache/node/24.10.0/x64/bin/npm
npm info using [email protected]
npm info using [email protected]
npm warn Unknown user config "always-auth". This will stop working in the next major version of npm.
npm verbose title npm publish
npm verbose argv "publish" "--access" "public" "--loglevel" "verbose"
npm verbose logfile logs-max:10 dir:/home/runner/.npm/_logs/2025-10-15T22_35_45_629Z-
npm verbose logfile /home/runner/.npm/_logs/2025-10-15T22_35_45_629Z-debug-0.log
npm verbose publish [ '.' ]
npm notice
npm notice 📦  @mockfetch/[email protected]
npm notice Tarball Contents
npm notice 1.1kB LICENSE
npm notice 6.1kB README.md
npm notice 6.6kB lib/index.cjs
npm notice 12.7kB lib/index.cjs.map
npm notice 1.6kB lib/index.d.ts
npm notice 6.1kB lib/index.js
npm notice 3.1kB lib/index.min.js
npm notice 11.8kB lib/index.min.js.map
npm notice 7.3kB lib/index.umd.js
npm notice 12.7kB lib/index.umd.js.map
npm notice 3.3kB lib/index.umd.min.js
npm notice 11.6kB lib/index.umd.min.js.map
npm notice 1.4kB package.json
npm notice Tarball Details
npm notice name: @mockfetch/mockfetch
npm notice version: 0.1.1
npm notice filename: mockfetch-mockfetch-0.1.1.tgz
npm notice package size: 14.2 kB
npm notice unpacked size: 85.5 kB
npm notice shasum: 0ab427df4157edb7ffbbd8b2d49566feb7efea5a
npm notice integrity: sha512-D8eDfCEWqRJGy[...]UqDVqaEzwtuVw==
npm notice total files: 13
npm notice
npm http fetch GET https://run-actions-3-azure-eastus.actions.githubusercontent.com/61//idtoken/***/***?api-version=2.0&audience=npm%3Aregistry.npmjs.org 200 82ms
npm notice SECURITY NOTICE: Breaking changes starting October 13, 2025. New tokens will be limited to a maximum lifetime of 90 days, and TOTP setup will be disabled. Classic tokens will be revoked in November. Update your CI/CD workflows to avoid disruption. Learn more: https://gh.io/npm-token-changes
npm http fetch POST 404 https://registry.npmjs.org/-/npm/v1/oidc/token/exchange/package/@mockfetch%2fmockfetch 574ms
npm verbose oidc Failed token exchange request with body message: OIDC token exchange error - package not found
npm http fetch GET 200 https://registry.npmjs.org/@mockfetch%2fmockfetch 709ms (cache miss)
npm notice Publishing to https://registry.npmjs.org/ with tag latest and public access
npm http fetch PUT 404 https://registry.npmjs.org/@mockfetch%2fmockfetch 159ms
npm verbose stack HttpErrorGeneral: 404 Not Found - PUT https://registry.npmjs.org/@mockfetch%2fmockfetch - Not found
npm verbose stack     at /opt/hostedtoolcache/node/24.10.0/x64/lib/node_modules/npm/node_modules/npm-registry-fetch/lib/check-response.js:103:15
npm verbose stack     at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
npm verbose stack     at async publish (/opt/hostedtoolcache/node/24.10.0/x64/lib/node_modules/npm/node_modules/libnpmpublish/lib/publish.js:53:15)
npm verbose stack     at async otplease (/opt/hostedtoolcache/node/24.10.0/x64/lib/node_modules/npm/lib/utils/auth.js:8:12)
npm verbose stack     at async #publish (/opt/hostedtoolcache/node/24.10.0/x64/lib/node_modules/npm/lib/commands/publish.js:188:7)
npm verbose stack     at async Publish.exec (/opt/hostedtoolcache/node/24.10.0/x64/lib/node_modules/npm/lib/commands/publish.js:47:5)
npm verbose stack     at async Npm.exec (/opt/hostedtoolcache/node/24.10.0/x64/lib/node_modules/npm/lib/npm.js:208:9)
npm verbose stack     at async module.exports (/opt/hostedtoolcache/node/24.10.0/x64/lib/node_modules/npm/lib/cli/entry.js:67:5)
npm verbose statusCode 404
npm verbose pkgid @mockfetch/[email protected]
npm error code E404
npm error 404 Not Found - PUT https://registry.npmjs.org/@mockfetch%2fmockfetch - Not found
npm error 404
npm error 404  The requested resource '@mockfetch/[email protected]' could not be found or you do not have permission to access it.
npm error 404
npm error 404 Note that you can also install from a
npm error 404 tarball, folder, http url, or git url.
npm verbose cwd /home/runner/work/mockfetch/mockfetch
npm verbose os Linux 6.11.0-1018-azure
npm verbose node v24.10.0
npm verbose npm  v11.6.2
npm verbose exit 1
npm verbose code 1
npm error A complete log of this run can be found in: /home/runner/.npm/_logs/2025-10-15T22_35_45_629Z-debug-0.log
Error: Process completed with exit code 1.

Expected Behavior

Running npm publish --access public --verbose should succeed.

Steps To Reproduce

Environment

  • npm: 11.6.2
  • Node.js: 24.10.0
  • OS Name: Ubuntu 24.04.3
  • System Model Name: VM used for running GitHub Actions
  • npm config:
; node bin location = /opt/hostedtoolcache/node/24.10.0/x64/bin/node
; node version = v24.10.0
; npm local prefix = /home/runner/work/mockfetch/mockfetch
; npm version = 11.6.2
; cwd = /home/runner/work/mockfetch/mockfetch
; HOME = /home/runner
; Run `npm config ls -l` to show all defaults.
  • npm config complete:
; "default" config from default values

_auth = (protected)
access = null
all = false
allow-same-version = false
also = null
audit = true
audit-level = null
auth-type = "web"
before = null
bin-links = true
browser = null
ca = null
cache = "/home/runner/.npm"
cache-max = null
cache-min = 0
cafile = null
call = ""
cert = null
cidr = null
color = true
commit-hooks = true
cpu = null
depth = null
description = true
dev = false
diff = []
diff-dst-prefix = "b/"
diff-ignore-all-space = false
diff-name-only = false
diff-no-prefix = false
scope = ""
script-shell = null
searchexclude = ""
searchlimit = 20
searchopts = ""
searchstaleness = 900
shell = "/bin/bash"
shrinkwrap = true
sign-git-commit = false
sign-git-tag = false
strict-peer-deps = false
strict-ssl = true
tag = "latest"
tag-version-prefix = "v"
timing = false
umask = 0
unicode = true
update-notifier = true
usage = false
user-agent = "npm/{npm-version} node/{node-version} {platform} {arch} workspaces/{workspaces} {ci}"
; userconfig = "/home/runner/.npmrc" ; overridden by env
version = false
versions = false
viewer = "man"
which = null
workspace = []
workspaces = null
workspaces-update = true
yes = null

; "user" config from /home/runner/work/_temp/.npmrc

//registry.npmjs.org/:_authToken = (protected)
always-auth = false
registry = "https://registry.npmjs.org/"

; "env" config from environment

userconfig = "/home/runner/work/_temp/.npmrc"

; "cli" config from command line options

long = true

Activity

  1. added
    Bug
    Needs Triage
    on Oct 15, 2025
  2. htdangkhoa commented on Oct 16, 2025

    @htdangkhoa

    same issue

  3. changed the title [-][BUG] Publishing another version with OIDC fails finding the earlier published version of a scoped package[/-] [+][BUG] Publishing another version with OIDC fails to find an earlier published version of a scoped package[/+] on Oct 16, 2025
  4. frantic1048 commented on Oct 21, 2025

    @frantic1048

    It might be worth checking npm package settings again. (See https://docs.npmjs.com/trusted-publishers#for-github-actions)

    I've encountered a similar issue caused by an incorrectly configured npm package...

  5. prantlf commented on Oct 21, 2025

    @prantlf
    Author

    It might be worth checking npm package settings again. (See https://docs.npmjs.com/trusted-publishers#for-github-actions)

    I've encountered a similar issue caused by an incorrectly configured npm package...

    I can't find anything to fix. What mistake did you make, if I may ask?

    These are my settings:

    Image

    My initial mistake was that the GitHub repo had to end with ".git" and I entered the name without it. It failed early and the error was clear that the repo wasn't connected to the package on npmjs. But once I fixed the name, it proceeded further.

    This error doesn't make sense:

    npm http fetch POST 404 https://registry.npmjs.org/-/npm/v1/oidc/token/exchange/package/@mockfetch%2fmockfetch 574ms
    

    The package @mockfetch%2fmockfetch exists. I was able to publish it from my machine.

  6. gaomeng1900 commented on Oct 22, 2025

    @gaomeng1900

    Updating npm is crucial. The default version of npm in node:20 does not support OIDC.

          # Ensure npm 11.5.1 or later is installed
          - name: Update npm
            run: npm install -g npm@latest
  7. gaomeng1900 commented on Oct 22, 2025

    @gaomeng1900

    It might be worth checking npm package settings again. (See https://docs.npmjs.com/trusted-publishers#for-github-actions)
    I've encountered a similar issue caused by an incorrectly configured npm package...

    I can't find anything to fix. What mistake did you make, if I may ask?

    These are my settings:

    Image My initial mistake was that the GitHub repo had to end with ".git" and I entered the name without it. It failed early and the error was clear that the repo wasn't connected to the package on npmjs. But once I fixed the name, it proceeded further.

    This error doesn't make sense:

    npm http fetch POST 404 https://registry.npmjs.org/-/npm/v1/oidc/token/exchange/package/@mockfetch%2fmockfetch 574ms
    

    The package @mockfetch%2fmockfetch exists. I was able to publish it from my machine.

    First of all. Remove .git from repo name.

  8. prantlf commented on Oct 22, 2025

    @prantlf
    Author

    Updating npm is crucial. The default version of npm in node:20 does not support OIDC.

      # Ensure npm 11.5.1 or later is installed
      - name: Update npm
        run: npm install -g npm@latest
    

    That's what I did. From npm config:

    ; node version = v24.10.0
    ; npm version = 11.6.2
    
  9. prantlf commented on Oct 22, 2025

    @prantlf
    Author

    My initial mistake was that the GitHub repo had to end with ".git" and I entered the name without it. It failed early and the error was clear that the repo wasn't connected to the package on npmjs. But once I fixed the name, it proceeded further.

    First of all. Remove .git from repo name.

    It succeeded! This is the log:

    Run npm publish --access public --verbose
      npm publish --access public --verbose
      shell: /usr/bin/bash -e {0}
      env:
        PNPM_HOME: /home/runner/setup-pnpm/node_modules/.bin
        NPM_CONFIG_USERCONFIG: /home/runner/work/_temp/.npmrc
        NODE_AUTH_TOKEN: XXXXX-XXXXX-XXXXX-XXXXX
    npm verbose cli /opt/hostedtoolcache/node/24.10.0/x64/bin/node /opt/hostedtoolcache/node/24.10.0/x64/bin/npm
    npm info using [email protected]
    npm info using [email protected]
    npm warn Unknown user config "always-auth". This will stop working in the next major version of npm.
    npm verbose title npm publish
    npm verbose argv "publish" "--access" "public" "--loglevel" "verbose"
    npm verbose logfile logs-max:10 dir:/home/runner/.npm/_logs/2025-10-22T11_15_22_758Z-
    npm verbose logfile /home/runner/.npm/_logs/2025-10-22T11_15_22_758Z-debug-0.log
    npm verbose publish [ '.' ]
    npm notice
    npm notice 📦  @mockfetch/[email protected]
    npm notice Tarball Contents
    npm notice 1.1kB LICENSE
    npm notice 12.1kB README.md
    npm notice 10.5kB dist/index.cjs
    npm notice 23.5kB dist/index.cjs.map
    npm notice 4.3kB dist/index.d.ts
    npm notice 1.8kB dist/index.d.ts.map
    npm notice 10.2kB dist/index.js
    npm notice 23.4kB dist/index.js.map
    npm notice 4.2kB dist/index.min.js
    npm notice 22.0kB dist/index.min.js.map
    npm notice 12.1kB dist/index.umd.js
    npm notice 23.5kB dist/index.umd.js.map
    npm notice 4.4kB dist/index.umd.min.js
    npm notice 21.9kB dist/index.umd.min.js.map
    npm notice 1.2kB dist/types/url-pattern.d.ts
    npm notice 1.9kB package.json
    npm notice Tarball Details
    npm notice name: @mockfetch/mockfetch
    npm notice version: 0.4.0
    npm notice filename: mockfetch-mockfetch-0.4.0.tgz
    npm notice package size: 25.9 kB
    npm notice unpacked size: 178.1 kB
    npm notice shasum: 110e5df0518111a689f00b0ea0d6c32c8fd17fc1
    npm notice integrity: sha512-OYXZYSGf5BWk1[...]O3GQ0C9ioegNw==
    npm notice total files: 16
    npm notice
    npm http fetch GET https://run-actions-1-azure-eastus.actions.githubusercontent.com/131//idtoken/***/***?api-version=2.0&audience=npm%3Aregistry.npmjs.org 200 70ms
    npm notice SECURITY NOTICE: Breaking changes starting October 13, 2025. New tokens will be limited to a maximum lifetime of 90 days, and TOTP setup will be disabled. Classic tokens will be revoked in November. Update your CI/CD workflows to avoid disruption. Learn more: https://gh.io/npm-token-changes
    npm http fetch POST 201 https://registry.npmjs.org/-/npm/v1/oidc/token/exchange/package/@mockfetch%2fmockfetch 759ms
    npm verbose oidc Successfully retrieved and set token
    npm http fetch GET 200 https://registry.npmjs.org/-/package/@mockfetch%2fmockfetch/visibility 155ms (cache miss)
    npm verbose oidc Enabling provenance
    npm http fetch GET 200 https://registry.npmjs.org/@mockfetch%2fmockfetch 714ms (cache miss)
    npm notice Publishing to https://registry.npmjs.org/ with tag latest and public access
    npm notice publish Signed provenance statement with source and build information from GitHub Actions
    npm notice publish Provenance statement published to transparency log: https://search.sigstore.dev/?logIndex=630059672
    npm http fetch PUT 200 https://registry.npmjs.org/@mockfetch%2fmockfetch 1958ms
    + @mockfetch/[email protected]
    npm verbose cwd /home/runner/work/mockfetch/mockfetch
    npm verbose os Linux 6.11.0-1018-azure
    npm verbose node v24.10.0
    npm verbose npm  v11.6.2
    npm verbose exit 0
    npm info ok
    

    I'm going to clean up the hardcoded testing publishing code from the workflow and test with the automated detection of a new version and publishing.

  10. prantlf commented on Oct 22, 2025

    @prantlf
    Author

    When I let the complete automated publishing running, it failed:

    npm verbose cli /opt/hostedtoolcache/node/24.10.0/x64/bin/node /opt/hostedtoolcache/node/24.10.0/x64/bin/npm
    npm info using [email protected]
    npm info using [email protected]
    npm warn Unknown user config "always-auth". This will stop working in the next major version of npm.
    npm verbose title npm publish
    npm verbose argv "publish" "--access" "public" "--loglevel" "verbose"
    npm verbose logfile logs-max:10 dir:/home/runner/.npm/_logs/2025-10-22T11_24_55_690Z-
    npm verbose logfile /home/runner/.npm/_logs/2025-10-22T11_24_55_690Z-debug-0.log
    npm verbose publish [ '.' ]
    npm notice
    npm notice 📦  @mockfetch/[email protected]
    npm notice Tarball Contents
    npm notice 1.1kB LICENSE
    npm notice 12.1kB README.md
    npm notice 10.5kB dist/index.cjs
    npm notice 23.5kB dist/index.cjs.map
    npm notice 4.3kB dist/index.d.ts
    npm notice 1.8kB dist/index.d.ts.map
    npm notice 10.2kB dist/index.js
    npm notice 23.4kB dist/index.js.map
    npm notice 4.2kB dist/index.min.js
    npm notice 22.0kB dist/index.min.js.map
    npm notice 12.1kB dist/index.umd.js
    npm notice 23.5kB dist/index.umd.js.map
    npm notice 4.4kB dist/index.umd.min.js
    npm notice 21.9kB dist/index.umd.min.js.map
    npm notice 1.2kB dist/types/url-pattern.d.ts
    npm notice 1.9kB package.json
    npm notice Tarball Details
    npm notice name: @mockfetch/mockfetch
    npm notice version: 0.4.1
    npm notice filename: mockfetch-mockfetch-0.4.1.tgz
    npm notice package size: 25.9 kB
    npm notice unpacked size: 178.1 kB
    npm notice shasum: d2f7c233d498855b0bd08727f17d81982c35d8de
    npm notice integrity: sha512-owB0dfKy0WCVi[...]Otv9/C3rrMDRw==
    npm notice total files: 16
    npm notice
    npm http fetch GET https://run-actions-3-azure-eastus.actions.githubusercontent.com/126//idtoken/***/***?api-version=2.0&audience=npm%3Aregistry.npmjs.org 200 106ms
    npm notice SECURITY NOTICE: Breaking changes starting October 13, 2025. New tokens will be limited to a maximum lifetime of 90 days, and TOTP setup will be disabled. Classic tokens will be revoked in November. Update your CI/CD workflows to avoid disruption. Learn more: https://gh.io/npm-token-changes
    npm http fetch POST 201 https://registry.npmjs.org/-/npm/v1/oidc/token/exchange/package/@mockfetch%2fmockfetch 692ms
    npm verbose oidc Successfully retrieved and set token
    npm http fetch GET 200 https://registry.npmjs.org/-/package/@mockfetch%2fmockfetch/visibility 125ms (cache miss)
    npm verbose oidc Enabling provenance
    npm http fetch GET 200 https://registry.npmjs.org/@mockfetch%2fmockfetch 73ms (cache miss)
    npm notice Publishing to https://registry.npmjs.org/ with tag latest and public access
    npm notice publish Signed provenance statement with source and build information from GitHub Actions
    npm notice publish Provenance statement published to transparency log: https://search.sigstore.dev/?logIndex=630081923
    npm http fetch PUT 200 https://registry.npmjs.org/@mockfetch%2fmockfetch 1398ms
    npm verbose cwd /home/runner/work/mockfetch/mockfetch
    npm verbose os Linux 6.11.0-1018-azure
    npm verbose node v24.10.0
    npm verbose npm  v11.6.2
    npm verbose exit 0
    npm info ok
    remote: Permission to prantlf/mockfetch.git denied to github-actions[bot].
    fatal: unable to access 'https://github.com/prantlf/mockfetch/': The requested URL returned error: 403
    "git push --atomic origin HEAD "v0.4.1""" exited with 128: 
    prepared version 0.4.1 for pushing
    + @mockfetch/[email protected]
    Error: Process completed with exit code 1.
    

    But it failed when pushing the changes and tag to git:

    remote: Permission to prantlf/mockfetch.git denied to github-actions[bot].
    fatal: unable to access 'https://github.com/prantlf/mockfetch/': The requested URL returned error: 403
    

    The NPM publishing part succeeded:

    npm notice Publishing to https://registry.npmjs.org/ with tag latest and public access
    npm notice publish Signed provenance statement with source and build information from GitHub Actions
    npm notice publish Provenance statement published to transparency log: https://search.sigstore.dev/?logIndex=630081923
    npm http fetch PUT 200 https://registry.npmjs.org/@mockfetch%2fmockfetch 1398ms
    + @mockfetch/[email protected]
    

    It's strange, because there's no change on the GitHub side regarding git. The bot has had the write permissions to the repo:

    Image

    I'll continue looking into the error returned by git. At least, it's no a problem with NPM any more. Thank you for you help!

  11. prantlf commented on Oct 22, 2025

    @prantlf
    Author

    I cracked it. I made a mistake when I updated the job configuration. This was the fix:

       linux:
         runs-on: ubuntu-latest
         permissions:
    -      contents: read
    +      contents: write
           id-token: write
         steps:
         - uses: actions/checkout@v5

    Initially, I didn't include the permissions object. I set up the write permissions for the bot in the repo settings. When I configured the new NPM publishing, I followed the NPM documentation and added this:

    permissions:
      id-token: write  # Required for OIDC
      contents: read

    I didn't realise that the contents: read affected the GitHub token issued for the job. Although the repo settings allowed writing, the contents: read entry removed it. So, in my case I have to use contents: write.

    I don't have the very original error log any more, but when I see the last one:

    remote: Permission to prantlf/mockfetch.git denied to github-actions[bot].
    

    I think that when I saw prantlf/mockfetch.git in the error, I somehow connected it to prantlf/mockfetch, which I'd just entered in the NPM package settings. And I started looking at the NPM part.

    Anyway, the problem explained and solved :-)

  12. prantlf commented on Oct 22, 2025

    @prantlf
    Author

    You might want to extend the NPM documentation. I think that many projects automate new releases in their workflows:

    1. Detect the need for a new version, updating changelog and bumping the package version
    2. Publish a new NPM package
    3. Commit the version changes, tag them with the new version and push them to git
    4. Create GitHub release for the new tag

    The last two steps need the write access to the repo. If you mention it in your documentation, you'll prevent other issues like this in the future :-) If there's at least one other guy like me, who'll read the following and insert it to their job configuration without realising that it'll break the git and GitHub publishing :-)

    permissions:
      id-token: write  # Required for OIDC
      contents: read

    For example:

    permissions:
      id-token: write  # Required for OIDC
      contents: read   # Use `write` if you push to git

    I got a hint in a StackOverflow post.

    And you might want to emphasise that the repo name in the OIDC setting is without the ".git" suffix. The suffix is included in git messages and it might confuse people like me, who may enter it to the NPM configuration :-)

    Thank you!

  13. 28 remaining items

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugNeeds Triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions