Skip to content

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

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?

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