github动作在列表中运行的名称
我有一个github操作,该操作设置了一个名称并在拉动请求上运行:
name: Code Quality
on:
workflow_dispatch:
pull_request:
branches: [ main, develop ]
当我手动触发运行时(因为 workflow_dispatch
也设置了),运行将在列表中获得标题“代码质量”跑步。
但是,当操作通过拉动请求运行时,列表中的运行名称设置为PR的名称。这可能是一个好的标题,这取决于公关的作者。有没有办法影响列表中动作的标题?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
自2022年9月以来,可能有一种方法可以设置运行本身的标题:
您现在有:
在文档上进行扩展:
例如
,考虑一个涉及功能开发和错误修复的项目中的工作流程。
该项目使用两种主要类型的分支:
功能/
bugfix/
该工作流是通过针对
main的拉请求触发的。
分支。您希望工作流程的名称可以反映正在集成的工作类型,它来自的特定分支以及启动运行的用户名称:这将有助于快速识别工作流程的性质,当GitHub存储库中的标签。该工作流程配置为触发针对
main
分支的拉动请求。run-name
字段使用表达式基于分支类型(feature/
或bugfix/
),动态构建运行名称,以及发起跑步的演员的github用户名。功能/
前缀),则运行名称以“功能”开头。bugfix/
前缀为前缀),则运行名称以“ BugFix”开头。github.head_ref
)和启动运行的演员的用户名(github.actor
)。该示例包括一个名为
build-and Test
的简化作业,该作业设置了node.js环境,安装依赖项并运行测试。该部分是许多JavaScript项目的标准配置,但可以根据您的项目需求进行定制。上下文:
run-name
github操作中的属性工作流程使您可以动态设置每个工作流程的名称。该功能对于区分GitHub UI中的运行尤其有用,尤其是在各种事件触发或需要特定上下文以了解运行的目的或来源的复杂工作流程中。它支持表达式,基于触发事件的上下文,输入或GitHub上下文中可用的任何其他相关信息启用动态运行名称。
以反映:
push
,pull_request
,workflow_dispatch
等)该名称将:
Since Sept. 2022, there might be a way to set the title of the run itself:
You now have:
To expand on the documentation:
Example
Consider, as an example, a workflow in a project that involves both feature development and bug fixes.
That project uses two primary types of branches:
feature/
bugfix/
The workflow is triggered by pull requests targeting the
main
branch. You want the workflow run's name to reflect the type of work being integrated, the specific branch it is coming from, and the name of the user who initiated the run: that would help quickly identify the nature of the workflow run when looking through the Actions tab in the GitHub repository.That workflow is configured to trigger on pull requests targeting the
main
branch.The
run-name
field uses expressions to dynamically construct the run name based on the branch type (feature/
orbugfix/
), the branch name, and the GitHub username of the actor who initiated the run.feature/
), the run name starts with "Feature".bugfix/
), the run name starts with "Bugfix".github.head_ref
) and the username of the actor who initiated the run (github.actor
).The example includes a simplified job called
build-and-test
that sets up a Node.js environment, installs dependencies, and runs tests. That part is standard for many JavaScript projects but can be customized based on your project's needs.Context:
The
run-name
attribute in GitHub Actions workflows allows you to dynamically set the name of each workflow run. That feature is particularly useful for distinguishing between runs at a glance in the GitHub UI, especially in complex workflows triggered by various events or requiring specific context to understand the run's purpose or origin.It supports expressions, enabling dynamic run names based on the context of the trigger event, inputs, or any other relevant information available in the GitHub context.
You can use context and expressions to tailor run names to reflect:
push
,pull_request
,workflow_dispatch
, etc.)That will:
似乎没有一种方法可以设置运行本身的标题(参考)。
计划和手动运行将获得工作流的标题,并且由Commit / PR触发的运行将获得提交消息或PR标题。
但是,请注意,提交/PR标题还显示了 工作流的名称,该名称出现在两个地方:
It does not seem like there is a way to set the title of the run itself (reference).
Scheduled and manual runs will get the title of the workflow, and runs triggered by commit / PR will get the commit message or PR title.
However, notice that the commit / PR title is displayed in addition to the name of the workflow, which appears in two places: