A workflow trigger specifies what causes a GitHub Actions workflow to start. It is configured in the YAML workflow file under the on key. section 12.2.1
Choose triggers according to how the workflow should begin:
- Use a push trigger to run after code is pushed, optionally limiting it to selected branches such as main. section 12.2.1
- Use a pull request or other activity trigger when workflow execution should respond to that GitHub event. section 12.2.1
- Use workflow_dispatch when someone should start the workflow manually. section 12.2.1
Run on pushes to main or manually
name: Build and Deploy MauiStockTake on: push: branches: - main workflow_dispatch:
Listing 12.3 The build-and-deploy.yaml file
name: Build and Deploy MauiStockTake #1
on: #2
push: #3
branches: #4
- main #5
workflow_dispatch: #6
Inspect the complete trigger configuration and its surrounding workflow declaration. section 12.2.1








