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

Auto-updating Github Action matrix for node (i.e. ci-config-github-actions) #416

Closed
dominykas opened this issue Oct 13, 2020 · 4 comments
Closed

Comments

@dominykas
Copy link
Member

I played around with this a little bit, and since the only re-usable primitive in Github Actions is a step packaged as an "action", the only possible implementation to have an auto-updating matrix is something like this:

jobs:
  prepare-node-matrix:
    runs-on: ubuntu-latest
    outputs:
      matrix: ${{ steps.set-matrix.outputs.matrix }}
    steps:
      - uses: nodejs/ci-config-github-actions@master
        id: set-matrix
        with:
          gte: 10
          policy: lts

  test:
    needs: prepare-node-matrix
    strategy:
      matrix:
        node-version: ${{ fromJson(needs.prepare-node-matrix.outputs.matrix) }}

1️⃣ Which is suuuuuuuper verbose? Did I miss something? What do people do to solve this issue - do they generate actions or smth from templates? Would we need a CLI or smth to help with that generation? I can't imagine someone copy/pasting that across hundreds of repos in an organization?

2️⃣ It also makes wonder if it's worth maintaining an action, when instead of the uses: nodejs/ci-config-github-actions@master block (5 lines) you could run: npx @pkgjs/node-matrix --gte 10 --policy lts instead?

3️⃣ But if we are to keep the action - should we rename the repo to something that follows the action convetion better, e.g. nodejs/version-matrix-action?

@thescientist13
Copy link
Contributor

thescientist13 commented Nov 17, 2020

@dominykas
Looks like something like what you're looking for is on the GitHub roadmap for Q2/2021? github/roadmap#98

@dominykas
Copy link
Member Author

Yes, can't wait for workflow partials!

In the meantime sounds like we'll want to build an installable module, so we'll see where that takes us, I guess.

@dominykas dominykas removed the package-maintenance-agenda Agenda items for package-maintenance team label Nov 30, 2020
@dominykas
Copy link
Member Author

So, in general, looks like this will be somewhat addressed by GH work, and in the meantime we agreed that maybe some node package, which fails things when workflows are out of date might be useful. I'll be doing some related work on wiby side, and will open a new issue if/when I have something that's worth sharing.

Closing this for now.

@ljharb
Copy link
Member

ljharb commented Nov 30, 2020

fwiw, I’ve made an action ( https://github.com/ljharb/actions/tree/HEAD/node/matrix ) which is reusable, supports semver strings, and is also always up to date. I’ll be using it on all 200-300 of my repos, so hopefully it’ll be reliable :-)

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

No branches or pull requests

3 participants