Triggers
  • 1 Minute to read
  • Dark
    Light
  • PDF

Triggers

  • Dark
    Light
  • PDF

Article summary

Triggers overview

Triggers are events that kick off workflows. Triggers are defined in a workflow file and are named after familiar Git commands push, pull_request (Design Review), issues, and release

Triggers are defined in workflow YAML Files

Once a workflow file is pushed to a repository, the triggers will automatically be enabled and AllSpice will start listening for your events.

Here is an excerpt from an example workflow file:

# .allspice/workflows/your_workflow.yml
name: Generate BOM
run-name: ${{ allspice.actor }} is testing out AllSpice Actions 🚀

# Define triggers with `on:`
on:
  # Add your triggers here
  # You can use more than one trigger to run the same code
  # If you need to use different triggers, simply create a separate workflow file.
  push:
  issues:
    types: [opened, closed, reopened]

jobs:
  Your_job:
   # Your job steps

Defining the Workflow Trigger with on

The on keyword determines the events that will trigger your workflow. It can be a single event, a list of events, or a more complex configuration.

Single Event Trigger:

on: push

Multiple Event Triggers:

on: [push, pull_request]

Advanced Trigger Configuration:

You can specify triggers based on branches, tags, or paths.

on:
  push:
    branches:
      - main
      - 'release/*'
    paths:
      - 'src/**'
      - '!src/exclude_this_file.py'

Examples of triggers

  • on push

    • Generate BOM

    • Check part numbers against component allow-list

    • Generate COGS

    • Check DRC rules are correct

  • on merge pull_request closed

    • Create release fabrication package

      • Copy approved files from design review to release zip file

      • Check file format and naming conventions have been used

        • Check and filter out problematic naming conventions PCB1234-V2_thisone-revG.pcb

    • Update PLM

    • Generate archival/compliance Design Review package of checklist/comments/attachments

    • Add firmware from linked repos

  • on release

    • Notify CM/JDM

    • Notify Planning/Purchasing

    • Backup/distribute files

  • on issue / pull_request_review_comment

    • New part request workflow

    • Smart comments allow you to add your own #tags in comments to trigger software

      • Create issue from comment

      • Add new checks to the main checklist from a comment

    • Integrate your native issue tracking / comment system using Actions or Webhooks

List of triggers

trigger event

activity types

create

—

delete

—

fork

—

gollum (wiki)

—

push

—

issues

opened, edited, closed, reopened, assigned, unassigned, milestoned, demilestoned, labeled, unlabeled

issue_comment

created, edited, deleted

pull_request

opened, edited, closed, reopened, assigned, unassigned, synchronize, labeled, unlabeled

pull_request_review

submitted, edited

pull_request_review_comment

created, edited

release

published, edited

registry_package

published

For pull_request events, in GitHub Actions, the ref is refs/pull/:prNumber/merge, which is a reference to the merge commit preview. However, AllSpice.io has no such reference. Therefore, the ref in AllSpice.io Actions is refs/pull/:prNumber/head, which points to the head of pull request rather than the preview of the merge commit.


Was this article helpful?

What's Next