我该如何创建一个只能手动启动的工作流,同时需要指定它将使用哪个特定的提交?
workflow_dispatch
事件上运行。inputs
来定义你的参数。on:
workflow_dispatch:
inputs:
myCommit:
description: 'Commit SHA1'
required: true
default: 'undefined'
type: string
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Do something
run: your_command ${{ inputs.myCommit }}
...
以下是一个检出特定提交版本进行构建的示例:
on:
workflow_dispatch:
inputs:
refToBuild:
description: 'Branch, tag or commit SHA1 to build'
required: true
type: string
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ inputs.refToBuild }}
- name: Build
run: <command for build>