创建 GitHub 检查运行仅将结果附加到第一个操作运行。

huangapple go评论81阅读模式
英文:

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

问题

一个操作执行了一个 octokit 请求来创建一个检查运行:

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
  }
});

我检查了是否有一种方法可以将检查运行绑定到特定的操作运行,但根据文档 https://docs.github.com/en/rest/checks/runs?apiVersion=2022-11-28#create-a-check-run,我没有找到方法来实现这样的操作:

基本上发生的情况是,我有两个工作流程通过推送触发。检查运行可以分配给其中任何一个,通常是触发的第一个,这是相当随机的。然后,如果重新运行,将在首次执行的基本运行上创建另一个检查。我想将检查运行分配给特定工作流程的特定运行,这是否可能?

英文:

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

得分: 1

确保您在不同的检查运行中使用不同的 name。否则,GitHub 的用户界面只会显示其中一个。

英文:

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

huangapple
  • 本文由 发表于 2023年7月4日 20:45:07
  • 转载请务必保留本文链接:https://go.coder-hub.com/76612787.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定