Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

Expose `strategy` and `matrix` variables in `context`

Offen
#615 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
35/100
Issue-Typ
Feature
Klarheit
Größtenteils klar
Aktivitätsstatus
Veraltet
Tech-Stack
github-actions, javascript, typescript
Bereich
ci-cd, tooling

Rechercherichtung

Start with actions/github-script@v7 and trace how the script receives its context object, then compare the available GitHub Actions strategy and matrix values with the requested names. Done means workflow scripts can access the requested values through context, with tests or examples covering matrix and strategy usage.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

Is your feature request related to a problem? Please describe.

I'm using a matrix and I want to access matrix- and strategy-related variables in my github-script. The two ways to do that are:

  1. Setting env vars:
# ...
strategy:
  matrix:
    group: [1, 2]
steps:
  - uses: actions/github-script@v7
    env:
      MATRIX_GROUP: ${{ matrix.group }}
      MATRIX_NUM_GROUPS: ${{ strategy.job-total }}
    with:
      script: |
        const group = parseInt(process.env.MATRIX_GROUP)
        const numGroups = parseInt(process.env.MATRIX_NUM_GROUPS)
  1. Interpolation:
# ...
strategy:
  matrix:
    group: [1, 2]
steps:
  - uses: actions/github-script@v7
    with:
      script: |
        const group = ${{ matrix.group }}
        const numGroups = ${{ strategy.job-total }}

Describe the solution you'd like
It would be nice if these were offered somewhere in the context object, which seems like an intuitive home for them. Something like...

# ...
strategy:
  matrix:
    group: [1, 2]
steps:
  - uses: actions/github-script@v7
    with:
      script: |
        const group = parseInt(context.strategy.matrix.group)
        const numGroups = context.strategy.totalJobs
Vorherrschende Sprache
TypeScript
Sterne
5k
Forks
586
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus actions/github-script

Alle Issues in actions/github-script

Ähnliche Issues

Weitere Issues zu TypeScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.