-
-
Notifications
You must be signed in to change notification settings - Fork 13
Description
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@v1This 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.
action-workflow_run-status/src/main.ts
Lines 84 to 87 in 967ed83
| 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.