Package-maintenance: Auto-updating Github Action matrix for node (i.e. ci-config-github-actions)

Created on 13 Oct 2020  路  4Comments  路  Source: nodejs/package-maintenance

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?

Most helpful comment

fwiw, I鈥檝e 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鈥檒l be using it on all 200-300 of my repos, so hopefully it鈥檒l be reliable :-)

All 4 comments

@dominykas
Looks like something like what you're looking for is on the GitHub roadmap for Q2/2021? https://github.com/github/roadmap/issues/98

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.

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.

fwiw, I鈥檝e 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鈥檒l be using it on all 200-300 of my repos, so hopefully it鈥檒l be reliable :-)

Was this page helpful?
0 / 5 - 0 ratings