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

Job not found #158

Open
polarathene opened this issue May 12, 2021 · 3 comments
Open

Job not found #158

polarathene opened this issue May 12, 2021 · 3 comments

Comments

@polarathene
Copy link

Workflow snippet triggered on workflow_run:

jobs:
  preview:
    name: 'Deploy Preview'
    runs-on: ubuntu-20.04
    if: ${{ github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' }}
    steps:
      - uses: haya14busa/action-workflow_run-status@v1

This workflow works correctly, but breaks when trying to use this action as above. Actions error log:

Run haya14busa/action-workflow_run-status@v1
  with:
    github_token: ***
    requested_as_pending: true
Error: job not found: preview

This is likely the same issue that was recently closed by the issue author for unknown reasons. Unlike others chiming in there I am not using any matrix.


Quick glance over the code suggests that job.name is probably Deploy Preview which is obviously not going to match the context.job that the error logs as preview. Presumably if I match the name value to the job object name the two values will resolve this issue.

const job = jobs.data.jobs.find(j => j.name === context.job)
if (!job) {
throw new Error(`job not found: ${context.job}`)
}

It looks like you could reference a job by id? For those using a matrix, that may not work? context.github.job provides the current job id. Will this work?:

const job = jobs.data.jobs.find(j => j.id === context.github.job)

I don't develop actions, and the documentation is lacking what the context.job.job object contains. One issue I linked to mentions context.jobId but I am lacking documentation to know if that's suggested or valid.

@polarathene
Copy link
Author

Confirmed. Setting name: 'preview' satisfies the action match for j.name === context.job. This is undesirable.

@phosphene
Copy link

Yes. I can confirm that defining a name in the job causes this action to fail.

@cattermo
Copy link

Defining a name or using matrix will cause this problem. Would be great if it could be solved.

steve-haar added a commit to steve-haar/ng-clarity that referenced this issue Jun 27, 2022
steve-haar added a commit to vmware-clarity/ng-clarity that referenced this issue Jun 27, 2022
kevinbuhmann added a commit to vmware-clarity/ng-clarity that referenced this issue Jul 5, 2022
kevinbuhmann added a commit to vmware-clarity/ng-clarity that referenced this issue Jul 5, 2022
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

3 participants