Skip to content

Tips & Tricks

Test trigger with empty commit

For fully automatic pipelines, i.e. ones that run on PR open or merge, you can trigger the behavior by adding a push to your branch, then pushing an empty commit.

For example, in the hugo-release.yml pipeline, the pipeline watches for changes to .version and .bumpversion.toml on pull requests that are merged to the main branch:

---
name: Hugo release

on:
  push:
    branches:
      - main
    paths:
      - ".version"
      - ".bumpversion.toml"

To test this automatic trigger from your branch, you can add the current branch name, i.e. feat/something-automatic, disable path filtering, and push an empty commit:

---
name: Hugo release

on:
  push:
    branches:
      - main
      ## Watch the current branch, in addition to main.
      #  Remove this when you're done testing, before
      #  merging back into main
      - feat/something-automatic

    ## Temporarily disable path watching
    # paths:
    #   - ".version"
    #   - ".bumpversion.toml"

Commit these changes, push them, then create and push an empty commit to trigger it:

git commit --allow-empty -m "chore: test workflow trigger"
git push

Important

Don’t forget to put your triggers back to normal after a successful test. Remove the branch and uncomment any filtering rules that should run on main.

Last updated on