Pau*_*aul 7 yaml action build github github-actions
我需要确保使用 github 操作进行测试,如果之前已进行过包含单词 的提交build。如果提交不包含该单词build,则不应运行 github 操作的测试。
你能给我一些建议吗?
测试:
name: "Testing"
on:
push:
branches:
- master
jobs:
test_the_action:
name: Test the action
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- uses: suisei-cn/actions-download-file@master
id: downloadfile
name: Download a file
with:
url: "[API Endpoint](https://api.github.com/repos/suisei-cn/actions-download-file)"
target: public/
auto-match: true
- name: Display the file
run: head -n8 public/actions-download-file
Run Code Online (Sandbox Code Playgroud)
Gui*_*urd 14
从推送事件中,可以使用以下方法提取提交消息github.event.commit.message
请注意,如果有多个提交消息:
commit[0]包含最旧的提交${{ github.event.commits[0].message }}
Run Code Online (Sandbox Code Playgroud)
head_commit包含最年轻的提交${{ github.event.head_commit.message }}
Run Code Online (Sandbox Code Playgroud)
然后,您可以检查提交消息是否包含您想要的单词,例如使用:
${{ github.event.commits[0].message }}
Run Code Online (Sandbox Code Playgroud)
因此,如果您不希望在提交消息包含“构建”一词时运行作业,您的工作流程可能如下所示:
${{ github.event.head_commit.message }}
Run Code Online (Sandbox Code Playgroud)
最后,您现在还可以选择在提交消息中使用关键字跳过 ci 工作流程。
| 归档时间: |
|
| 查看次数: |
9066 次 |
| 最近记录: |