Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

context.runAttempt is undefined using github-script v7

Aperta
#566 3 commenti 3 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
github-actions, typescript
Ambito
devops

Direzione di ricerca

Start by comparing the README.md reference with the @actions/github version used by github-script v7, then inspect actions/toolkit's packages/github/src/context.ts and the published package metadata. Reproduce the workflow shown in the issue and confirm that context.runAttempt returns the run attempt value rather than undefined.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

dependencies

Describe the bug

Attempting to access GITHUB_RUN_ATTEMPT using context.runAttempt gives back undefined

To Reproduce
Steps to reproduce the behavior:

Create following test workflow and run it

on:
  workflow_dispatch:

jobs:
  deploy:
    runs-on: ubuntu-latest
    timeout-minutes: 30
    steps:

      - uses: actions/github-script@v7
        with:
          script: |
            const runAttempt = parseInt(process.env.GITHUB_RUN_ATTEMPT, 10);
            core.warning(`context.runAttempt content: ${context.runAttempt} - ${runAttempt}`);

Result in:
Warning: context.runAttempt content: undefined - 1

Expected behavior

context.runAttempt should hold the correct value according to the link https://github.com/actions/toolkit/blob/main/packages/github/src/context.ts used in README.md

After looking at the actions/toolkit repository i wonder if the version linked was actually released at all, the actions/toolkit repo don't have any tags for @actions/github-6.0.0 and the release in npmjs date back to 10/10/2023 while the commit adding runAttempt date 28/10/2023 ..

Lingua principale
TypeScript
Stelle
5k
Fork
586
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di actions/github-script

Tutte le issue di actions/github-script

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.