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

Viewed 7226

I created the workflow Test but there is no Run workflow button to run it manually.

enter image description here

This is my test.yml file. 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!
3 Answers

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).

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.

select workflow config based on branch

You need to put workflow_dispatch: under 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.

enter image description here

enter image description here

It's ok to put workflow_dispatch: before 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!
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.

on:
  workflow_dispatch: {}
Related