Skip to content

Token seems to expire after 1h #121

Closed
@Afoucaul

Description

@Afoucaul

I'm running a workflow (target-workflow.yml) in another repository (target-repo) of my organization using https://github.com/aurelien-baudet/workflow-dispatch (v2).
To that end I'm generating an app token with actions/create-github-app-token@v1.
I can generate the token with no issues, and aurelien-baudet/workflow-dispatch@v2 manages to trigger target-workflow.yml all right as well.
However, after some time, fetching the status of target-workflow starts to fail with Warning: Failed to get workflow status: Bad credentials. This causes my parent job to fail.
That seems to start happening after exactly 1h.

Am I correct that the token expires after 1h? Is it documented somewhere?
Also, is there a way to extend the lifetime of this token? Otherwise, do you suggest a workaround?

My workflow:

name: Run target-workflow.yml in other target-repo

permissions:
  id-token: write
  contents: read

jobs:
  run-target-workflow:
    name: Run target-workflow
    runs-on: ubuntu-latest
    steps:
      - uses: actions/create-github-app-token@v1
        id: app-token
        with:
          app-id: ...  # My app id
          private-key: ...  # My private key
          repositories: "target-repo"

      - name: Run workflow in target-repo
        uses: aurelien-baudet/workflow-dispatch@v2
        with:
          ref: main
          repo: target-repo
          workflow: target-workflow.yml
          wait-for-completion: true
          wait-for-completion-timeout: 2h
          token: ${{ steps.app-token.outputs.token }}
          inputs: ...  # The relevant inputs to target-workflow

The output of aurelien-baudet/workflow-dispatch@v2 step:

Run aurelien-baudet/workflow-dispatch@v2
Workflow triggered 🚀
You can follow the running workflow here: https://github.com/...
Warning: The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
Waiting for workflow completion
Warning: Failed to get workflow status: Bad credentials
Warning: Failed to get workflow status: Bad credentials
Warning: Failed to get workflow status: Bad credentials
... 

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