<p>I am setting up Github Actions for a project repository. </p>

<p>The workflow consists of the following steps:</p>

<ul>
<li>Building a docker image </li>
<li>Pushing the image to a container registry</li>
<li>Rollout a Kubernetes deployment. </li>
</ul>

<hr>

<p>However, I have two different Kubernetes deployments: one for development, and one for production. Hence, I have also two Github Action workflows.</p>

<p>The Github Action workflow for development is triggered everytime that a commit is pushed:</p>

<pre><code>on:
  push:
    branches:
    - master
</code></pre>

<p>But I don't want that for my production workflow. I would need a manual trigger, like a <em>Send to production</em> button. I didn't see anything close to that in the docs.</p>

<hr>

<p><strong><em>Is there a way to trigger a workflow manually in Github Actions?</em></strong></p>

<p><strong><em>How can I split my development and my production workflows to achieve what I want, either on Github Actions, Docker or Kubernetes?</em></strong></p>

Antoine C.
<blockquote>
<p>Is there a way to trigger a workflow manually in Github Actions?</p>
</blockquote>
<p>You might consider, <a href="https://github.blog/changelog/2020-07-06-github-actions-manual-triggers-with-workflow_dispatch/" rel="noreferrer">from July2020</a>:</p>
<blockquote>
<h2>GitHub Actions: Manual triggers with workflow_dispatch</h2>
</blockquote>
<p>(Note: or multiple workflows, through the <a href="https://stackoverflow.com/a/63317065/6309">new Composite Run Steps</a>, August 2020)</p>
<blockquote>
<p>You can now create workflows that are manually triggered with the new <code>workflow_dispatch</code> event.<br />
You will then see a '<code>Run workflow</code>' button on the Actions tab, enabling you to easily trigger a run.</p>
<p><a href="https://i.stack.imgur.com/reBTv.png" rel="noreferrer"><img src="https://i.stack.imgur.com/reBTv.png" alt="https://i2.wp.com/user-images.githubusercontent.com/1865328/86147571-2de93700-babf-11ea-8a08-e4beffd3abe9.png?ssl=1" /></a></p>
<p>You can choose which branch the workflow is run on.</p>
</blockquote>
<p><a href="https://stackoverflow.com/users/1631219/philippe">philippe</a> adds <a href="https://stackoverflow.com/questions/58933155/manual-workflow-triggers-in-github-actions/62768214#comment111440150_62768214">in the comments</a>:</p>
<blockquote>
<p>One thing that's not mentioned in the documentation: the workflow must exist on the default branch for the &quot;<code>Run workflow</code>&quot; button to appear.<br />
Once you add it there, you can continue developing the action on its own branch and the changes will take effect when run using the button</p>
</blockquote>
<p>The documentation goes on:</p>
<blockquote>
<p>In addition, you can optionally specify inputs, which GitHub will present as form elements in the UI. Workflow dispatch inputs are specified with the same format as action inputs.</p>
<p>For example:</p>
</blockquote>
<pre><code>on: 
  workflow_dispatch:
    inputs:
      logLevel:
        description: 'Log level'     
        required: true
        default: 'warning'
      tags:
        description: 'Test scenario tags'  
</code></pre>
<blockquote>
<p>The triggered workflow receives the inputs in the <code>github.event</code> context.</p>
<p>For example:</p>
</blockquote>
<pre><code>jobs:
  printInputs:
    runs-on: ubuntu-latest
    steps:
    - run: |
        echo &quot;Log level: ${{ github.event.inputs.logLevel }}&quot;
        echo &quot;Tags: ${{ github.event.inputs.tags }}&quot; 
</code></pre>
<hr />
<p><a href="https://stackoverflow.com/users/1032372/shim">shim</a> adds in <a href="https://stackoverflow.com/questions/58933155/manual-workflow-triggers-in-github-actions/62768214?noredirect=1#comment121548076_62768214">the comments</a>:</p>
<blockquote>
<p>You can add <code>workflow_dispatch</code> to a workflow that also has other triggers (like <code>on push</code> and / or <code>schedule</code>)</p>
<p><a href="https://gist.github.com/simonbromberg/d9dfbbd3fcf481dd59dc522f0d12cdf6" rel="noreferrer">For instance</a>:</p>
<pre class="lang-yaml prettyprint-override"><code>on:
 workflow_dispatch:
 push:
   branches:
     - master
 pull_request:
   types: [opened, synchronize, reopened]
</code></pre>
</blockquote>
