Skip to content

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

Closed

Description

@dominykas

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?

Activity

  1. thescientist13 commented on Nov 17, 2020

    @thescientist13
    SponsorContributor

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

  2. dominykas commented on Nov 17, 2020

    @dominykas
    MemberAuthor

    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.

  3. dominykas commented on Nov 30, 2020

    @dominykas
    MemberAuthor

    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.

  4. ljharb commented on Nov 30, 2020

    @ljharb
    SponsorMember

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions