Is there a way to restrict what branch an action can be run on?

Viewed 1448

When running a github action manually, I can choose which branch to run it against. This seems like a bad idea for some actions. Especially actions along the lines of DeployToProduction - where I only ever want that to be run against the main branch.

Is there any way to restrict it to only run against main - while still making the action manually-triggered?

An example of a manually-triggered action that I have might look something like this:

---
name: DeployToStaging
on:
  workflow_dispatch:
jobs: 
  ...
1 Answers
Related