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

[BUG]: Cannot redefine key #107

Open
carlosmfreitas2409 opened this issue Nov 12, 2024 · 3 comments · May be fixed by #109
Open

[BUG]: Cannot redefine key #107

carlosmfreitas2409 opened this issue Nov 12, 2024 · 3 comments · May be fixed by #109
Labels
bug Something isn't working

Comments

@carlosmfreitas2409
Copy link

carlosmfreitas2409 commented Nov 12, 2024

Hello!

I have the following step (exactly as it says in the README):

- name: Setup bun
  uses: oven-sh/setup-bun@v2
  with:
    bun-version: 1.1.26
    registry-url: https://npm.pkg.github.com/
    scope: '@my-org'

- name: Install dependencies
  env:
    BUN_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  run: bun install --frozen-lockfile

And when running the workflow, the following error occurs:
Image

The bunfig.toml was created automatically by the action and looks like this:

[install.scopes]
'@my-org' = { token = "$BUN_AUTH_TOKEN", url = "https://npm.pkg.github.com/"}

There is an issue with this problem (#33), but it is closed and without a solution.

@Yurchishin
Copy link

Fix Summary

I resolved an issue related to package installation in the CI/CD pipeline. Here's how:

  1. Avoid committing .npmrc
    Remove or avoid committing the .npmrc file. For reasons I couldn't fully determine, having .npmrc with bunfig.toml in the repository caused configuration issues on the CI/CD side.

  2. Commit a custom bunfig.toml file
    To enable local package installation, create and commit a bunfig.toml file with the following content and commit it:

    [install.scopes]
    '@my-org' = { token = "$BUN_AUTH_TOKEN", url = "https://npm.pkg.github.com" }
  3. Set up a .env file for local development
    Ensure you have a .env file locally to define the BUN_AUTH_TOKEN for authentication:

    BUN_AUTH_TOKEN=******
  4. Update your CI/CD workflow
    Use the following configuration in your GitHub Actions workflow to install dependencies:

    - name: Install Bun
      uses: oven-sh/setup-bun@v2
    - name: Install Dependencies
      run: bun install --frozen-lockfile
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Optional
        NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Optional
        BUN_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

@xhyrom
Copy link
Collaborator

xhyrom commented Nov 16, 2024

We should probably create some sort of merge mechanic like in #39

@xhyrom xhyrom added the bug Something isn't working label Nov 16, 2024
@xhyrom xhyrom linked a pull request Nov 16, 2024 that will close this issue
@xhyrom
Copy link
Collaborator

xhyrom commented Nov 16, 2024

Hi @carlosmfreitas2409 and @Yurchishin, could you please test my PR fixing this issue? I think oven-sh/setup-bun@feat/multiple-registries or oven-sh/setup-bun@7ac6e6faeade3b75e9bff88d66e9200170e311cd should work :)

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

Successfully merging a pull request may close this issue.

3 participants