Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support being used in a Reusable workflow #62

Open
MPV opened this issue Jan 20, 2025 · 1 comment
Open

Support being used in a Reusable workflow #62

MPV opened this issue Jan 20, 2025 · 1 comment

Comments

@MPV
Copy link

MPV commented Jan 20, 2025

I haven't been able to get this action working when it's a part of a reusable workflow, have you?

I keep having it erroring out like this:

Polling API for checks status, iteration: 89 out of 90
Warning: Error extracting job name from workflow file, falling back to "allchecks" (this may not be correct): Error: Error getting file: Not Found
Warning: Could not determine own allcheckspassed check (expected name: "allchecks", this may cause an indefinite loop)
Polling API for checks status, iteration: 90 out of 90
Error: Some checks have failed or timed out, please check the workflow run summary to get the details

This is what it looks like in my reusable workflow:

name: Checks

on:
  workflow_call:

jobs:
  allchecks:
    name: allchecks
    # job name hardcoded so it can find and exclude itself (self-detection seems to fail)
    permissions:
      checks: read
      contents: read
    runs-on: ubuntu-latest
    steps:
      - uses: wechuli/allcheckspassed@2e5e8bbc775f5680ed5d02e3a22e2fc7219792ac # v1.1.0
        with:
          retries: "90"
          polling_interval: "1"

And here is one way to consume it:

name: all-checks-pass

on:
  pull_request:

jobs:
  allchecks:
    name: allchecks
    permissions:
      checks: read
      contents: read
    uses: myorg/reusable-workflows/.github/workflows/all-checks-pass.yml@master
    secrets: inherit
@wechuli
Copy link
Owner

wechuli commented Jan 20, 2025

Ah, reusables would break the logic of how the action is getting the name of the check that it created:

export async function extractOwnCheckNameFromWorkflow(owner: string = github.context.repo.owner , repo: string = github.context.repo.repo, path: string=extractFilePath(), ref: string = sanitizedInputs.commitSHA) {

In the case of a reusable job, GitHub builds the check name from all the jobs in the chain, so in your case the check is called allchecks / allchecks but the current logic expects the check to just be called allchecks. I'll do some tests to see if there is a way to definitively know if the job is part of a reusable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants