{"id":15758044,"url":"https://github.com/ahmadnassri/action-github-registry-npm-proxy","last_synced_at":"2025-03-13T17:34:36.893Z","repository":{"id":39628993,"uuid":"336409036","full_name":"ahmadnassri/action-github-registry-npm-proxy","owner":"ahmadnassri","description":"sets up an .npmrc file that points to GPR as a proxy","archived":false,"fork":false,"pushed_at":"2023-09-13T21:26:58.000Z","size":90,"stargazers_count":4,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-05-02T05:33:57.166Z","etag":null,"topics":["github","gpr","npm","packages","proxy","registry"],"latest_commit_sha":null,"homepage":"","language":"Makefile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ahmadnassri.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["ahmadnassri"]}},"created_at":"2021-02-05T22:59:51.000Z","updated_at":"2023-03-21T21:59:36.000Z","dependencies_parsed_at":"2024-10-04T09:42:04.612Z","dependency_job_id":"6198df1b-9c44-42ae-8fa5-d282a248f5a8","html_url":"https://github.com/ahmadnassri/action-github-registry-npm-proxy","commit_stats":null,"previous_names":[],"tags_count":35,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahmadnassri%2Faction-github-registry-npm-proxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahmadnassri%2Faction-github-registry-npm-proxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahmadnassri%2Faction-github-registry-npm-proxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahmadnassri%2Faction-github-registry-npm-proxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ahmadnassri","download_url":"https://codeload.github.com/ahmadnassri/action-github-registry-npm-proxy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221395497,"owners_count":16812213,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["github","gpr","npm","packages","proxy","registry"],"created_at":"2024-10-04T09:41:55.913Z","updated_at":"2024-10-25T06:21:37.331Z","avatar_url":"https://github.com/ahmadnassri.png","language":"Makefile","funding_links":["https://github.com/sponsors/ahmadnassri"],"categories":[],"sub_categories":[],"readme":"# GitHub Package Registry as a proxy\n\nsets up an .npmrc file that points to GPR as a proxy\n\n[![license][license-img]][license-url]\n[![release][release-img]][release-url]\n\nAllows you to use the [GitHub Package Registry as a proxy][] for npm operations *(install, publish, etc ...)* so you don't have to manually distinguish between internal dependencies registry url and public ones.\n\n## Why\n\n**Doesn't [`@actions/setup-node`][] already do this?**\n\nNo, the `setup-node` action results in an `.npmrc` file that looks like this:\n\n``` ini\n//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}\n@scope:registry=https://npm.pkg.github.com\n```\n\nThis means that npm will continue to use the public npm registry for any packages NOT under the defined `@scope`.\n\nIf you want to use GitHub Package Registry as a proxy to the default npm registry, you need to use an `.npmrc` file that looks like this:\n\n``` ini\n//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}\nregistry=https://npm.pkg.github.com/scope/\n```\n\n**Why is this useful?**\n\n- Tighter control on publishing packages: never make the mistake of publishing to the `npmjs.com` registry! *(it just wont work)*\n- No need to manually distinguish between internal dependencies registry url and public ones in your config / ci\n- potential performance boost by using the GitHub registry as a proxy *(can't find any documentation on this to verify, but my own observations confirm it)*\n\n## Usage\n\n###### Example\n\nuse github registry for internal packages, and public registry for everything else\n\n``` yaml\non: push\n\njobs:\n  npm:\n    steps:\n      - uses: actions/checkout@v3\n      - uses: ahmadnassri/action-github-registry-npm-proxy@v6\n      - run: npm ci\n        env:\n          NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n```\n\n\u003e ###### result: `.npmrc`\n\u003e\n\u003e ``` ini\n\u003e //npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}\n\u003e registry=https://npm.pkg.github.com/ahmadnassri/\n\u003e ```\n\n\u003e **Warning**  \n\u003e you should specify a token value if you're installing private packages  \n\u003e or packages from other repositories within the same org\n\n###### Example\n\nset a custom path to `.npmrc` file and export it as `NPM_CONFIG_USERCONFIG` environment variable\n\n``` yaml\n- uses: ahmadnassri/action-github-registry-npm-proxy@v6\n  with:\n    path: ./path-to-package/.npmrc\n    export_config: true\n\n- run: npm ci\n  working-directory: ./path-to-package\n  env:\n    NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n```\n\n\u003e ###### result: `./path-to-package/.npmrc`\n\u003e\n\u003e ``` ini\n\u003e //npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}\n\u003e registry=https://npm.pkg.github.com/ahmadnassri\n\u003e ```\n\n###### Example\n\ndon't use the proxy, just set the registry url to the github registry for current scope\n\n``` yaml\n- uses: ahmadnassri/action-github-registry-npm-proxy@v6\n  with:\n    proxy: false\n```\n\n\u003e **Note**  \n\u003e this is the same as using [`@actions/setup-node`][] with `registry-url` option\n\n###### result: `.npmrc`\n\n``` ini\n//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}\n@ahmadnassri:registry=https://npm.pkg.github.com\n```\n\n###### Example\n\ncustom scope (e.g. packages from another github account/org)\n\n``` yaml\n- uses: ahmadnassri/action-github-registry-npm-proxy@v6\n  with:\n    scope: '@my-org'\n    token: ${{ secrets.github-personal-access-token }}\n```\n\n###### result: `.npmrc`\n\n``` ini\n//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}\nregistry=https://npm.pkg.github.com/@my-org/\n```\n\n### Inputs\n\n| input         | required | default                          | description                                                             |\n|---------------|----------|----------------------------------|-------------------------------------------------------------------------|\n| scope         | ❌       | `${{ github.repository_owner }}` | the \"npm scope\", typically this will be your GitHub username / org name |\n| path          | ❌       | `${{ github.workspace }}/.npmrc` | where to store the `.npmrc` file                                        |\n| export_config | ❌       | `false`                          | export the path to `.npmrc` as `NPM_CONFIG_USERCONFIG`                  |\n| token         | ❌       | `NODE_AUTH_TOKEN`                | environment variable name for the registry token                        |\n| proxy         | ❌       | `true`                           | enable/disable the GitHub npm packages proxy for npm                    |\n\n\u003e **Warning**\n\u003e Your github token should have the [appropriate scopes][] to be able to install private packages\n\n  [GitHub Package Registry as a proxy]: https://github.blog/2019-09-11-proxying-packages-with-github-package-registry-and-other-updates/\n  [`@actions/setup-node`]: https://github.com/actions/setup-node\n  [appropriate scopes]: https://docs.github.com/en/packages/learn-github-packages/about-permissions-for-github-packages#about-scopes-and-permissions-for-package-registries\n\n----\n\u003e Author: [Ahmad Nassri](https://www.ahmadnassri.com/) \u0026bull;\n\u003e Twitter: [@AhmadNassri](https://twitter.com/AhmadNassri)\n\n[license-url]: LICENSE\n[license-img]: https://badgen.net/github/license/ahmadnassri/action-github-registry-npm-proxy\n\n[release-url]: https://github.com/ahmadnassri/action-github-registry-npm-proxy/releases\n[release-img]: https://badgen.net/github/release/ahmadnassri/action-github-registry-npm-proxy\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fahmadnassri%2Faction-github-registry-npm-proxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fahmadnassri%2Faction-github-registry-npm-proxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fahmadnassri%2Faction-github-registry-npm-proxy/lists"}