Skip to content

context.runAttempt is undefined using github-script v7 #566

Open

Description

@bplessis-swi

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 ..

Activity

  1. joshmgross commented on May 8, 2025

    @joshmgross
    Contributor

    actions/toolkit#2054

    6.0.1 for @actions/github-script will have this, we just need to update this action to consume it.

  2. added
    dependencies
    on May 8, 2025
  3. jtbandes commented on Nov 26, 2025

    @jtbandes

    Looks like this still isn't fixed? @joshmgross @sneha-krip would someone be able to help get this dependency updated?

  4. jtbandes commented on Nov 26, 2025

    @jtbandes

    Here's a PR: #686

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

    dependencies

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions