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

chore: caches node modules in GitHub Actions workflow #43

Merged
merged 1 commit into from
Nov 2, 2022
Merged

chore: caches node modules in GitHub Actions workflow #43

merged 1 commit into from
Nov 2, 2022

Conversation

kleinfreund
Copy link
Contributor

Changes

Adds logic for caching the contents of the node_modules directory which speeds up workflow runs as long as the package.json file doesn't change (if the lock file is committed, it should be used to generate the caching key instead of the package.json file).

Adds pull requests as workflow triggers so people's contributions have tests running for them (for first-time contributors, a project maintainer must approve workflows to run, see https://github.blog/changelog/2021-04-22-github-actions-maintainers-must-approve-first-time-contributor-workflow-runs/; perhaps it's also possible to configure a repository so that this kind of approval is always required for branches on forks (origin repository branches would be fine because you would need push access anyway)).

Notes

  • Maybe the YARN_GPG isn't needed? This seems like a leftover from setting this up.

Adds logic for caching the contents of the node_modules directory which speeds up workflow runs as long as the package.json file doesn't change (if the lock file is committed, it should be part of the caching key instead of the package.json file).

Adds pull requests as workflow triggers so people's contributions have tests running for them (for first-time contributors, a project maintainer must approve workflows to run, see https://github.blog/changelog/2021-04-22-github-actions-maintainers-must-approve-first-time-contributor-workflow-runs/).
@kleinfreund
Copy link
Contributor Author

Comment: Interestingly, me opening this PR from a fork is already enough to trigger the GitHub workflow on the PR itself. I assume I'm allowed to do that because I'm a contributor? It would be good to consider the current settings for who is allowed to trigger workflows and specifically how changed workflows can be run on PRs from forks. Ideally, PRs from forks can't trigger workflow runs without explicit approval.

@zachleat
Copy link
Member

zachleat commented Nov 2, 2022

Appreciate you looking out! Gonna roll with this one! Let me know if you think I should make additional changes here!

@zachleat zachleat merged commit e822c21 into 11ty:main Nov 2, 2022
@zachleat zachleat added this to the Next Version milestone Nov 2, 2022
@kleinfreund kleinfreund deleted the chore/cache-dependencies-in-github-actions-workflow branch November 2, 2022 14:49
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.

2 participants