Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
fb4789a
WIP
sivanel97 Sep 15, 2025
bc754f1
Update images for UI indications section + updated examples
sivanel97 Sep 16, 2025
76a4332
Updated the first image and fixed a couple of capitalizations
sivanel97 Sep 16, 2025
cfcfb83
Merge branch 'main' into PORTN-3648-scab-docs
sivanel97 Sep 16, 2025
86b767c
Deleted the scorecards as blueprints page
sivanel97 Sep 16, 2025
149c595
Merge branch 'PORTN-3648-scab-docs' of https://github.com/port-labs/p…
sivanel97 Sep 16, 2025
6019059
added showLineNumbers to highlight the whole line
sivanel97 Sep 17, 2025
e27f3ee
added a mention to the entity API
sivanel97 Sep 21, 2025
feafe44
Merge branch 'main' of https://github.com/port-labs/port-docs into PO…
sivanel97 Oct 12, 2025
691485b
mentioned scorecard identifiers must be unique
sivanel97 Oct 15, 2025
7444277
Merge branch 'main' of https://github.com/port-labs/port-docs into PO…
sivanel97 Oct 16, 2025
7fd86a3
update the structure of the page
sivanel97 Oct 22, 2025
740b1c0
edit concepts-and-structure page structure and sections
sivanel97 Oct 23, 2025
632c68d
fix the delayed rule results wording
sivanel97 Oct 23, 2025
9eb73d6
update the delayed rule results section
sivanel97 Oct 29, 2025
17661a7
Merge branch 'main' of https://github.com/port-labs/port-docs into PO…
sivanel97 Nov 2, 2025
d0ccada
added a limitation for the 5 milion rule result entities
sivanel97 Nov 4, 2025
431b75f
Add the scorecards different dashboards
sivanel97 Nov 5, 2025
e2b914f
Added documentation regarding the scorecards permission management
sivanel97 Nov 5, 2025
ee3ed87
Advanced examples page - WIP
sivanel97 Nov 9, 2025
9c297c5
Advanced examples page - WIP
sivanel97 Nov 9, 2025
da1c16b
Attend to some of Hadar's comments
sivanel97 Nov 10, 2025
5a1a1f3
Attend to some of Hadar's comments
sivanel97 Nov 10, 2025
ae29bd3
Combined basic and advanced examples in the same page.
sivanel97 Nov 10, 2025
8c844fe
Add overview opening sentence as well as edit pilar page
sivanel97 Nov 13, 2025
0303c3b
Change the examples page structure -> split to two
sivanel97 Nov 13, 2025
c214af3
fix broken links
sivanel97 Nov 13, 2025
9cd8ea2
add the permissions behavior section
sivanel97 Nov 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
344 changes: 232 additions & 112 deletions docs/scorecards/concepts-and-structure.md

Large diffs are not rendered by default.

149 changes: 0 additions & 149 deletions docs/scorecards/examples.md

This file was deleted.

4 changes: 4 additions & 0 deletions docs/scorecards/examples/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"label": "Examples",
"position": 4
}
215 changes: 215 additions & 0 deletions docs/scorecards/examples/automation-use-cases.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,215 @@
---
sidebar_position: 2
---

# Automation use-cases

This page provides examples of automations that trigger when scorecard rule results are updated. These examples demonstrate how to notify teams via Slack or Microsoft Teams when rule results change, and how to automatically create GitHub issues when rule results degrade from `Passed` to `Not passed`.

## Notify on scorecard rule result updates

### Automation definition

By using the `ENTITY_UPDATED` trigger type, we can run custom logic whenever an entity of a specific type is updated.

The following configuration will cause a message to be sent whenever a scorecard rule result is updated:

<details>
<summary><b>Automation configuration (click to expand)</b></summary>

**Remember to change `github-org-name` and `github-repo-name` to your GitHub organization name and repository in the highlighted lines.**

```json showLineNumbers
{
"identifier": "ruleResultUpdated",
"title": "Rule result updated",
"trigger": {
"type": "automation",
"event": {
"type": "ENTITY_UPDATED",
"blueprintIdentifier": "_rule_result"
}
},
"invocationMethod": {
"type": "GITHUB",
# highlight-start
"org": "github-org-name",
"repo": "github-repo-name",
# highlight-end
"workflow": "notify-rule-result-updated.yaml",
"workflowInputs": {
"rule_result_name": "{{ .event.context.entityIdentifier }}",
"entity_link": "{{ .event.diff.after.properties.entity_link }}"
},
"reportWorkflowStatus": true
},
"publish": true
}
```
</details>

* `invocationMethod.workflowInputs` is the payload to be passed to the GitHub workflow upon every execution. In this example, we pass the rule result's identifier and the link to the evaluated entity.

* `invocationMethod.reportWorkflowStatus` is set to `true` to automatically update the action run in Port with the status of the GitHub workflow.

### Backend - GitHub workflow

The `notify-rule-result-updated.yaml` workflow will contain the logic to send a Slack/Teams message.

<h4>Prerequisite - set up webhooks</h4>

The workflow requires a Slack webhook URL and/or a Microsoft Teams webhook URL to send the message.

Slack:
1. To set up a Slack webhook, follow the instructions [here](https://api.slack.com/messaging/webhooks).
2. Once you have the webhook URL, add it as a secret in your GitHub repository named `SLACK_WEBHOOK_URL`.

Microsoft Teams:
1. To set up a Microsoft Teams webhook, follow the instructions [here](https://learn.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/add-incoming-webhook).
2. Once you have the webhook URL, add it as a secret in your GitHub repository named `TEAMS_WEBHOOK_URL`.

<details>
<summary><b>GitHub workflow (click to expand)</b></summary>

This workflow includes steps to send a message via **Slack** and **Microsoft Teams**.
**Use only the step(s) that apply to your use case.**

```yaml showLineNumbers title="notify-rule-result-updated.yaml"
name: Notify when rule result is updated

on:
workflow_dispatch:
inputs:
# Note that the inputs are the same as the payload (workflowInputs) defined in the automation
rule_result_name:
description: "The rule result's name"
required: true
type: string
entity_link:
description: "A link to the evaluated entity"
required: true
type: string

jobs:
send_message:
runs-on: ubuntu-latest
steps:
- name: Send message to Slack
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
run: |
curl -X POST -H 'Content-type: application/json' --data '{"text":"The rule result ${{ inputs.rule_result_name }} has been updated. See evaluated entity: https://app.port.io${{ inputs.entity_link }}"}' $SLACK_WEBHOOK_URL

- name: Send message to Microsoft Teams
env:
TEAMS_WEBHOOK_URL: ${{ secrets.TEAMS_WEBHOOK_URL }}
run: |
curl -H 'Content-Type: application/json' -d '{"text":"The rule result ${{ inputs.rule_result_name }} has been updated. See evaluated entity: https://app.port.io${{ inputs.entity_link }}"}' $TEAMS_WEBHOOK_URL
```
</details>

<br></br>
___
<br></br>

## Create a GitHub issue whenever a scorecard rule result is degraded

### Automation definition

By using the `ENTITY_UPDATED` trigger type, we can run custom logic whenever an entity of a specific type is updated.

The following configuration will create a GitHub issue whenever a scorecard rule result's `Result` property changes from `Passed` to `Not passed`:

<details>
<summary><b>Automation configuration (click to expand)</b></summary>

**Remember to change `github-org-name` and `github-repo-name` to your GitHub organization name and repository in the highlighted lines.**

```json showLineNumbers
{
"identifier": "ruleResultDegraded",
"title": "Rule result degraded",
"trigger": {
"type": "automation",
"event": {
"type": "ENTITY_UPDATED",
"blueprintIdentifier": "_rule_result"
},
"condition": {
"type": "JQ",
"expressions": [
".diff.before.properties.result == \"Passed\"",
".diff.after.properties.result == \"Not passed\""
],
"combinator": "and"
}
},
"invocationMethod": {
"type": "GITHUB",
# highlight-start
"org": "github-org-name",
"repo": "github-repo-name",
# highlight-end
"workflow": "create-issue-on-rule-degradation.yaml",
"workflowInputs": {
"rule_result_name": "{{ .event.context.entityIdentifier }}",
"entity_link": "{{ .event.diff.after.properties.entity_link }}"
},
"reportWorkflowStatus": true
},
"publish": true
}
```
</details>

* `trigger.condition` checks the rule result's `Result` property before and after the update. The automation will only run for rule results that have been degraded.

* `invocationMethod.workflowInputs` is the payload to be passed to the GitHub workflow upon every execution. In this example, we pass the rule result's identifier and the link to the evaluated entity.

* `invocationMethod.reportWorkflowStatus` is set to `true` to automatically update the action run in Port with the status of the GitHub workflow.

### Backend - GitHub workflow

The `create-issue-on-rule-degradation.yaml` workflow will contain the logic to create a GitHub issue.

<details>
<summary><b>GitHub workflow (click to expand)</b></summary>

```yaml showLineNumbers title="create-issue-on-rule-degradation.yaml"
name: Create issue when rule is degraded

on:
workflow_dispatch:
inputs:
# Note that the inputs are the same as the payload (workflowInputs) defined in the automation
rule_result_name:
description: 'The rule result name'
required: true
type: string
entity_link:
description: 'A link to the evaluated entity'
required: true
type: string

# Grant write access to issues so the workflow can create them
permissions:
contents: read
issues: write

jobs:
send_message:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: create an issue
uses: dacbd/create-issue-action@main
with:
token: ${{ github.token }}
# By default, the issue will be created in the same repository as the workflow
repo: ${{ github.context.repo.repo}}
title: '${{ inputs.rule_result_name }} - degraded rule result'
body: |
The rule result ${{ inputs.rule_result_name }} has been degraded.
See evaluated entity: https://app.port.io${{ inputs.entity_link }}
```
</details>
Loading