Skip to main content

GitHub trigger

This trigger is only available in the Smithy SaaS.

The GitHub trigger can run workflows automatically when events happen in your GitHub organisation. When you add this trigger to your workflow, the git-target component is added automatically behind the scenes. The git-target parameters are then populated by the GitHub trigger with every run.

You can scan all code in selected branches, the diff in Pull Requests or both. A scan can happen automatically when a branch or PR is updated, or manually when you run a workflow through the Smithy UI.

One Github trigger can target multiple repositories, branches and Pull Requests. If it does, each branch or PR is a separate target and will launch a separate run.

Requirements

  1. You need the Smithy GitHub app. It has to be installed in your GitHub organisation and needs to have read access to your repositories. The Smithy team can set that up for you during onboarding.
  2. You need to be authenticated with an email or GitHub single-sign-on in the Smithy portal.

UI Settings

Event Type

Setup the events that cause the trigger to run a workflow.

  • Branch update: The whole target branch will be scanned when it receives a new commit.
  • PR update: If a PR towards the target branch receives a new commit, run the workflow on the diff of the PR.
  • Branch update and PR update: Run a workflow on both events.

If you run a workflow with a GitHub trigger manually, the whole code of the target branch will be scanned.

Repositories

Select as many repositories as you like. If the repository you seek is not in the list, but is part of your GitHub organisation, this might mean that the Smithy GitHub app does not have permissions to it. Please contact the Smithy team for support.

Branches

You can add custom target branches here.

  • If you don't add any branches, Smithy will target the default branch of each repo.
  • If you add multiple branches, Smithy will try to target each added branch for each added repository. E.g. Use this if you want to scan my-repo branches main and develop and my-other-repo with branches main and develop.
  • If you want to scan multiple different branches for different repositories, you can create separate GitHub triggers for them. E.g. Create one GitHib trigger for my-repo branches one and two and another trigger for my-other-repo with branches three and four.

Here is what the settings look like in the UI:

Github trigger settings add - screenshot Github trigger settings set repo - screenshot Github trigger settings set branches - screenshot

Running the workflow

To run a workflow manually with this trigger, press "Launch Workflow" on the workflow page. You will get a choice of which target repositories and branches you want to scan. Then each selected target will launch into its own Run. Otherwise, the github app will launch the runs automatically when the events happen on GitHub.

Github trigger run - screenshot