Skip to content

ci: extract checkout, node setup, and install into setup action - #595

Merged
michaelfaith merged 1 commit into
mainfrom
ci/extract-setup-action
Nov 5, 2026
Merged

michaelfaith merged 1 commit into
mainfrom
ci/extract-setup-action

Conversation

@michaelfaith

Copy link
Copy Markdown
Contributor

This is in preparation for moving to pnpm. This change centralizes common ci setup steps into a single action.

This is in preparation for moving to pnpm.  This change centralizes common ci setup steps into a single action.
@michaelfaith
michaelfaith marked this pull request as ready for review November 4, 2026 12:51
@michaelfaith
michaelfaith requested a review from a team November 4, 2026 12:51

- name: Install dependencies
run: npm install
- uses: $/.github/actions/setup

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@michaelfaith is the $ required here?

Suggested change
- uses: $/.github/actions/setup
- uses: ./.github/actions/setup

I did a search we may need . instead of $ ? but i'm not an expert in reusable actions

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

same question for the other actions around calling reusable actions syntax

@michaelfaith michaelfaith Nov 5, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This was a recent change to workflows, which allows workflows to reference local actions without having to checkout the repo. That's what allows for us to include the checkout action in the setup action. Otherwise, there would be a chicken and egg situation. When using the old . way of referencing, you have to checkout the repo before you can reference local actions (so you wouldn't be able to include checkout). But using the new $ syntax, you don't have to 😊

Ref: https://github.blog/changelog/2026-07-30-reference-same-repository-actions-with-self-repository-syntax/

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

gosh didn't know about this either. thanks!

@lwasser lwasser left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@michaelfaith this is awesome. i never thought about using reusable actions as a setup mechanism. i had just a few questions around

  • syntax using $/ vs ./
  • node version at 24 throughout and then
  • npm install vs npm ci

type: string
node-version:
description: Node.js version to use
default: '22'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

here we declare node 22 but below we use 24 to build the cli

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
default: '22'
default: '24'

?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm ok with that. I just didn't want to change our node support in the same change. I was going for as like-to-like behavior with the refactor.

- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
- uses: $/.github/actions/setup
with:
node-version: '24'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

here node 24 vs 22 declared above. i'm just curious why not use 24 throughout?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I was just going for like-for-like behavior, and it just be a reorganization of actions. Then followup with node version bumps separately. But I could do it here too if you want.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

no - no worries if that is your goal. let's merge as is.

with:
node-version: ${{ inputs.node-version }}
- name: Install dependencies
run: npm install ${{ inputs.install-flags }}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
run: npm install ${{ inputs.install-flags }}
run: npm ci ${{ inputs.install-flags }}

could we use ci rather than install for ci jobs? we'd probably want the dependencies to NOT update in ci because we'd want to ensure we are maintaining them locally and get the same results as ci returns.

@michaelfaith michaelfaith Nov 5, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The problem with npm ci is it doesn't reuse node_modules. So it wouldn't take advantage of the cache. Since our ultimate aim is to move to pnpm, I figured it would be ok to go with this temporarily. With pnpm, its default behavior is to force a frozen lockfile in ci. So there'd be no special handling needed 😊

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ok perfect. i suspected you. had a reason for this so appreciate the answers and i didn't realize it wouldn't leverage the cache as well! thanks! pnpm will be a good move!

@lwasser lwasser left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm actually ok with your merging after answering questions as I may need to learn a bit more about reusable actions too here!! ✨

@lwasser

lwasser commented Nov 5, 2026

Copy link
Copy Markdown
Member

this needs a rebase - i don't love the update branch button as it creates a merge commit which makes rebasing icky 🙃 so i won't use it!

@michaelfaith

Copy link
Copy Markdown
Contributor Author

i don't love the update branch button as it creates a merge commit which makes rebasing icky 🙃 so i won't use it!

If you click the dropdown arrow, you can choose rebase

screenshot

@michaelfaith

Copy link
Copy Markdown
Contributor Author

It looks like there are no conflict. So I'll go ahead and merge, and we can do the node bumps separately.

@michaelfaith
michaelfaith merged commit 46b17ff into main Nov 5, 2026
6 checks passed
@michaelfaith
michaelfaith deleted the ci/extract-setup-action branch November 5, 2026 02:24
lwasser added a commit to all-contributors/app that referenced this pull request Nov 9, 2026
closes #647 

This migrates us to a reusable action similar to w[hat was done in the
cli](all-contributors/cli#595)
This will make updates to ci simpler. It also removes the stats.yml run
that runs for 3+ hours daily and doesn't share the data anywhere!! i
have recreated that worfklow to be more efficient [in the dashboard
repo](https://all-contributors.github.io/dashboard/)

- [ ] Documentation
- [x] Ready to be merged <!-- In your opinion, is this ready to be
merged as soon as it's reviewed? -->
- [ ] Added myself to contributors table. <!-- this is optional, see the
contributing guidelines for instructions -->
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