Skip to content

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

Open
@bplessis-swi

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    dependenciesPull requests that update a dependency file

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions