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

Delete .npmrc, create it on the fly in CI #29

Merged
merged 2 commits into from
Oct 3, 2023

Conversation

pcholakov
Copy link
Contributor

For local development we assume that npm is already properly configured. Removing the bundled dot file avoids overriding personal configurations.

@pcholakov pcholakov force-pushed the remove-committed-npmrc branch from 6468a4e to da1c82f Compare September 22, 2023 13:10
For local development we assume that npm is already properly configured.
Removing the bundled dot file avoids overriding personal configurations.
@pcholakov pcholakov force-pushed the remove-committed-npmrc branch from da1c82f to 31b9c8b Compare September 22, 2023 13:12
@pcholakov pcholakov marked this pull request as ready for review September 22, 2023 13:15
- name: Create .npmrc
run: |
echo '@restatedev:registry=https://npm.pkg.github.com/' > ~/.npmrc
echo '//npm.pkg.github.com/:_authToken=${GH_PACKAGE_READ_ACCESS_TOKEN}' >> ~/.npmrc
- run: npm ci --prefix typescript
env:
GH_PACKAGE_READ_ACCESS_TOKEN: ${{ secrets.GH_PACKAGE_READ_ACCESS_TOKEN }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @pcholakov, that's a nice improvement!

I think that you need to add that env variable to the step, or alternatively, interpose ${{ secrets.GH_PACKAGE_READ_ACCESS_TOKEN }} directly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we? I think we want the literal content:

@restatedev:registry=https://npm.pkg.github.com/
//npm.pkg.github.com/:_authToken=${GH_PACKAGE_READ_ACCESS_TOKEN}

to land up in .npmrc without any interpolation; the next step is going to use this and that's the step that already has the env variable set. npm will do the expansion when npm ci runs. I'm going to try move it from ~/.npmrc to typescript/.npmrc to see if that fixes it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah gotcha! This would also work 👌

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As long as it works 😅 I figured even though GHA executions are ephemeral, it's better to keep the secret in memory and not write it out into the config file.

@jackkleeman jackkleeman merged commit df0c2e6 into restatedev:main Oct 3, 2023
1 check failed
@pcholakov pcholakov deleted the remove-committed-npmrc branch October 3, 2023 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants