Creating a github check run attaches results to only first actions run

372 Views Asked by At

An action performs an octokit request to create a check run:

const context = require('@actions/github').context;

octokit.rest.checks.create({
  ...context.repo,
  name: name_task,
  head_sha: context.sha,
  status: 'completed',
  conclusion: 'success',
  output: {
    title: 'Results',
    summary
  }
});

I checked if there's a way to bind a check run to a specific action run but I don't see a way to do so based on the docs: https://docs.github.com/en/rest/checks/runs?apiVersion=2022-11-28#create-a-check-run

Basically what happens is that I have 2 workflows triggering by a push. The check run can get assigned to either of them, and usually it's the one that triggered first which is pretty random. Then, if you do a rerun another check will get created on the base run that was first performed. I'd like to assign a check run to a specific run of a specific workflow, is it possible?

1

There are 1 best solutions below

2
Gregor On

Make sure you use a different name for different check runs. Otherwise only one of them will be shown in GitHub's UI.