From 8c0225b046678749515e97815f92a139b10e8715 Mon Sep 17 00:00:00 2001 From: Ofer Affias Date: Thu, 24 Apr 2025 12:47:50 +0300 Subject: [PATCH] Add 'on' event triggers to Dependabot automation examples Improve layout of triggers defaults --- .../integrations/dependabot/approve_dependabot.cm | 5 ++++- .../dependabot/approve_dependabot_minor.cm | 8 +++++++- docs/execution-model.md | 10 ++++++++++ docs/stylesheets/extra.css | 12 ++++++++---- .../extract_dependabot_version_bump.cm | 6 ++++++ 5 files changed, 35 insertions(+), 6 deletions(-) diff --git a/docs/downloads/automation-library/integrations/dependabot/approve_dependabot.cm b/docs/downloads/automation-library/integrations/dependabot/approve_dependabot.cm index 06d156df3..7cb2a7b1a 100644 --- a/docs/downloads/automation-library/integrations/dependabot/approve_dependabot.cm +++ b/docs/downloads/automation-library/integrations/dependabot/approve_dependabot.cm @@ -5,6 +5,9 @@ manifest: automations: approve_dependabot: + on: + - pr_created + - commit if: - {{ branch.name | includes(term="dependabot") }} - {{ branch.author | includes(term="dependabot") }} @@ -16,4 +19,4 @@ automations: - action: merge@v1 args: wait_for_all_checks: true - squash_on_merge: true \ No newline at end of file + squash_on_merge: true diff --git a/docs/downloads/automation-library/integrations/dependabot/approve_dependabot_minor.cm b/docs/downloads/automation-library/integrations/dependabot/approve_dependabot_minor.cm index 247dd9f5a..1ff3119ca 100644 --- a/docs/downloads/automation-library/integrations/dependabot/approve_dependabot_minor.cm +++ b/docs/downloads/automation-library/integrations/dependabot/approve_dependabot_minor.cm @@ -3,6 +3,9 @@ manifest: automations: merge_dependabot_minor: + on: + - pr_created + - commit if: - {{ bump == 'minor' }} - {{ branch.name | includes(term="dependabot") }} @@ -14,6 +17,9 @@ automations: comment: | Dependabot `minor` version bumps are approved automatically. merge_dependabot_minor_patch: + on: + - pr_created + - commit if: - {{ bump == 'patch' }} - {{ branch.name | includes(term="dependabot") }} @@ -26,4 +32,4 @@ automations: comment: | Dependabot `patch` version bumps are approved and merged automatically. -bump: {{ pr.description | extractDependabotVersionBump | compareSemver }} \ No newline at end of file +bump: {{ pr.description | extractDependabotVersionBump | compareSemver }} diff --git a/docs/execution-model.md b/docs/execution-model.md index 168f67e01..97b933e47 100644 --- a/docs/execution-model.md +++ b/docs/execution-model.md @@ -42,6 +42,7 @@ The `triggers` section in gitStream gives you precise control over when automati Additionally, the `on` keyword defines specific events that trigger automations. It can be added at the file level (under the `triggers` section) or within individual automations for greater customization. Multiple triggers can be stacked, meaning gitStream will execute the automation for each matching triggering event, allowing flexibility in defining automation behavior +
| Key | Type | Description | | ----------------------------------------------------- | ----------------- | -------------------------------------------------------------- | | `triggers.on` :fontawesome-brands-github: | [String] | Specifies the explicit triggers that initiate the automations. | @@ -49,9 +50,11 @@ Additionally, the `on` keyword defines specific events that trigger automations. | `triggers.exclude.branch` :fontawesome-brands-github: | [String or regex] | Branches that match will not trigger the automation. | | `triggers.include.repository` | [String or regex] | Repositories that match will trigger the automation. | | `triggers.exclude.repository` | [String or regex] | Repositories that match will not trigger the automation. | +
The table below lists supported explicit triggers, categorized into those enabled by default and those that require manual activation. +
| Triggering event | Explicit Trigger :fontawesome-brands-github: | Default (implicit triggers) | | --------------------------------------------------------------------- | -------------------------------------------- | ------------------------------ | | Creating a PR | `pr_created` | `on` | @@ -67,6 +70,7 @@ The table below lists supported explicit triggers, categorized into those enable | :fontawesome-brands-github: transition from any state to closed | `pr_closed` | `off` | | :fontawesome-brands-github: transition from closed to open | `pr_reopened` | `off` | | :fontawesome-brands-github: Transition from any state to approved | `pr_approved` | If there is an automation with one of the actions: `require-reviewers`, `set-required-approvals` or `merge`, or uses `pr.approvals` context variable | +
Explicit triggers are set independently per each automation block and can be configured at the file level, specific to each automation separately or in combination. If triggers are listed at the file level **and** specific automation, the automation will be triggered according to both triggers. If an automation block does not have explicit triggers configured, it will be triggered according to the default (implicit) triggers. @@ -145,6 +149,9 @@ triggers: automations: bump_minor: + on: + - pr_created + - commit if: - {{ bump == 'minor' }} - {{ branch.name | includes(term="dependabot") }} @@ -157,6 +164,9 @@ automations: Dependabot `minor` version bumps are approved automatically. bump_patch: + on: + - pr_created + - commit if: - {{ bump == 'patch' }} - {{ branch.name | includes(term="dependabot") }} diff --git a/docs/stylesheets/extra.css b/docs/stylesheets/extra.css index 555582f8d..afe51022f 100644 --- a/docs/stylesheets/extra.css +++ b/docs/stylesheets/extra.css @@ -5,11 +5,11 @@ h2 { padding-top: 4%; -} +} h4 { padding-top: 4%; -} +} /* make the first column wider as usually this is a variable name that cant wrap normally */ th:nth-child(1){ @@ -24,6 +24,10 @@ div.filter-details th:nth-child(1){ width: 20%; } +div.trigger-details th:nth-child(2){ + width: 30%; +} + /* change the table colors for light mode */ [data-md-color-scheme="default"] table th{ background: #D8DADE; @@ -104,7 +108,7 @@ div.flow-chart { color: gray; } -.tabbed-content .md-typeset .admonition { +.tabbed-content .md-typeset .admonition { font-size: .8rem; } @@ -178,7 +182,7 @@ div.flow-chart { width:auto; height: 3em; } - + .integrations-card-labels { font-size: 0.7em; color: #9aa4ad; /* this is a medium grey color */ diff --git a/plugins/filters/extractDependabotVersionBump/extract_dependabot_version_bump.cm b/plugins/filters/extractDependabotVersionBump/extract_dependabot_version_bump.cm index e779a3f58..b1265ff31 100644 --- a/plugins/filters/extractDependabotVersionBump/extract_dependabot_version_bump.cm +++ b/plugins/filters/extractDependabotVersionBump/extract_dependabot_version_bump.cm @@ -3,6 +3,9 @@ manifest: automations: bump_minor: + on: + - pr_created + - commit if: - {{ bump == 'minor' }} - {{ branch.name | includes(term="dependabot") }} @@ -15,6 +18,9 @@ automations: Dependabot `minor` version bumps are approved automatically. bump_patch: + on: + - pr_created + - commit if: - {{ bump == 'patch' }} - {{ branch.name | includes(term="dependabot") }}