简体   繁体   English

未显示工作流程,因此我无法手动运行它(Github Actions)

[英]Workflow is not shown so I cannot run it manually (Github Actions)

I created the workflow Test but there is no Run workflow button to run it manually.我创建了工作流Test ,但没有手动运行它的Run workflow按钮。

在此处输入图像描述

This is my test.yml file.这是我的test.yml文件。 Is there anything missing?有什么遗漏吗?

name: Test

on:
  release:
    types: [created]
  
jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2

      - name: Run a one-line script
        run: echo Hello, world!

You need to put workflow_dispatch: under on: .您需要将workflow_dispatch:放在on:下。

name: Test

on:
  release:
    types: [created]
  workflow_dispatch: # Put here!!
  
jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2

      - name: Run a one-line script
        run: echo Hello, world!

Then, a Run workflow button is shown.然后,将显示一个Run workflow按钮。

在此处输入图像描述

在此处输入图像描述

It's ok to put workflow_dispatch: before release: .可以将workflow_dispatch:放在release:之前。 It works as well.它也有效。

name: Test

on:
  workflow_dispatch: # Putting here is also fine!!
  release:
    types: [created]
  
jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2

      - name: Run a one-line script
        run: echo Hello, world!

Some workflows, such as those, based on workflow_dispatch event, the workflow will not even show until the code is not on main (or default branch).一些工作流,例如那些基于workflow_dispatch事件的工作流,工作流甚至不会显示,直到代码不在main (或默认分支)上。

The good news is, once you did merge your feature to main , you may keep on working on the feature branch, because from now on, you will have the option to choose, based on which branch you want to run the workflow, like in the picture.好消息是,一旦你将你的特性合并到main ,你可能会继续在特性分支上工作,因为从现在开始,你可以根据你想要运行工作流的分支来选择,比如在图片。

根据分支选择工作流配置

on:
  workflow_dispatch: {}
  push:
    branches:
      - 'feature/name-of-feature-branch'

Trigger workflow on push and define your branch under branches: .推送时触发工作流并在分支下定义您的分支: . When your development is done and ready to merge main remove unnecessary code.当您的开发完成并准备合并 main 时,删除不必要的代码。

on:
  workflow_dispatch: {}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM