Tan*_*shk 1 github-actions github-cli
我的仓库中有两个分支,即main和kaju1,
在main分支(默认)上,定义了两个工作流push.yml和test.yml。
在kaju1分支上,定义了push.yml、test.yml、 和三个工作流程pr.yml。
我想使用 github cli 在分支pr.yml上触发 ie kaju1。
我尝试使用这段代码:
gh workflow run --repo username/repo-name --ref kaju1 pr.yml
Run Code Online (Sandbox Code Playgroud)
但这返回给我以下错误:
HTTP 404: Not Found (https://api.github.com/repos/username/repo-name/actions/workflows/pr.yml)
Run Code Online (Sandbox Code Playgroud)
我做了一些研究,发现工作流程仅适用于两个条件
main (默认)分支中。所以我想到的,我将把它保留在其他分支(我想要的)中,然后我将在其on:push上添加触发器,因为每次推送到该分支时都会触发它,然后我将用它if/else来区分on:push和on:workflow_dispach
on:
push:
branches:
- "other-branch"
workflow_dispatch:
inputs:
greeting:
description: 'Greetings'
required: true
default: 'Hello, World'
type: string
jobs:
job1:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'workflow_dispatch' }}
steps:
- uses: actions/checkout@v3
Run Code Online (Sandbox Code Playgroud)
现在每次推送时它至少会在 中注册github/actionss,然后
gh workflow run --repo username/repo-name --ref other-branch pr.yml
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1601 次 |
| 最近记录: |