Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Invoke GitHub Actions workflow manually and pass parameters

I want to pass some dynamic parameters and invoke my GitHub Actions workflow manually (ideally via some API). Is this possible?

like image 706
Raj Chaudhary Avatar asked Jul 05 '20 02:07

Raj Chaudhary


People also ask

How do I manually trigger a GitHub Actions workflow?

On GitHub.com, navigate to the main page of the repository. Under your repository name, click Actions. In the left sidebar, click the workflow you want to run. Above the list of workflow runs, select Run workflow.

How do I run jobs sequentially in GitHub Actions?

To run jobs sequentially, you can define dependencies on other jobs using the jobs. <job_id>. needs keyword. Each job runs in a runner environment specified by runs-on .

How do I run a pull action on GitHub?

Run Actions on Pull Requests When creating a new workflow in GitHub's action builder the default trigger is the push event. You want to extend this to push and pull request events. Search the line on: [push] in your GitHub Action workflow file. Extend it to on: [push, pull_request] and you're done.


1 Answers

With the workflow_dispatch event trigger, you can do the manual triggers easily.

Flow:

on: 
  workflow_dispatch:
    inputs:
      logLevel:
        description: 'Log level'     
        required: true
        default: 'warning'
      tags:
        description: 'Test scenario tags'  

Manual trigger screenshot: screenshot

Blog post announcement reference, https://github.blog/changelog/2020-07-06-github-actions-manual-triggers-with-workflow_dispatch/

like image 68
chenrui Avatar answered Oct 26 '22 05:10

chenrui