Skip to main content

Slack reminders for scorecards

This guide takes 7 minutes to complete, and aims to demonstrate:

  • How to initiate changes in the organization using scorecards
  • How to automate Slack reminders using Port's self service actions
Prerequisites
  • This guide assumes you have a Port account and that you have finished the onboarding process. We will use the Service blueprint that was created during the onboarding process.
  • You will need a Git repository in which you can place a workflow/pipeline that we will use in this guide. If you don't have one, we recommend creating a new repository named Port-actions.

The goal of this guide

In this guide we will create a self-service action that sends a Slack reminder for uncompleted scorecard rules. In reality, such an action can be used by R&D managers / Platform engineers to remind developers of unmet standards.

After completing it, you will get a sense of how it can benefit different personas in your organization:

  • Developers will be notified about policies set by the platform engineer that need to be fixed.
  • R&D managers & Platform engineers will be able to remind developers about unmet requirements in the services.

Setup the action's frontend

Let's start by creating the action's frontend. This is the part that will be used by developers to trigger the action:

Onboarding

As part of the onboarding process, you should already have an action named Send scorecard reminder in your self-service tab. In that case, you can skip to the Define action type step.

If you skipped the onboarding, or you want to create the action from scratch, complete steps 1-4 below.

Create the action's frontend (steps 1-4)
  1. To get started, head to the Self-service tab in your Port application, and click on New action:
  1. Each action in Port is directly tied to a blueprint. Since we are sending a reminder for a service, we will use the Service blueprint we created in the quickstart guide from the dropdown.

  2. Fill in the basic details of the action like this, then click Next:

  1. Click Next again, since we won't need inputs from the user in this action.

Define backend type

Now we'll define the backend of the action:

  • Choose Github workflow as the invocation type.
  • Replace the Organization and Repository values with your values (this is where the workflow will reside and run).
  • Name the workflow port-slack-reminder.yml.
  • Fill out the rest of the form like this, then click Next:


The last step is customizing the action's permissions. For simplicity's sake, we will use the default settings. For more information, see the permissions page. Click Create.

The action's frontend is now ready 🥳


Setup the action's backend

Now we want to write the logic that our action will trigger:

  1. First, let's create the necessary token and secrets:

    • Go to your desired Slack channel and setup incoming webhooks. Make sure you copy the webhook URL, we will use it in the Github workflow.

    • Go to your Port application, click on the ... in the top right corner, then click Credentials. Copy your Client ID and Client secret.

  2. In the repository where your workflow will reside, create 3 new secrets under Settings -> Secrets and variables -> Actions:

  • SLACK_WEBHOOK_URL - the Slack Webhook URL of the destination channel.
  • PORT_CLIENT_ID - the client ID you copied from your Port app.
  • PORT_CLIENT_SECRET - the client secret you copied from your Port app.


  1. Now let's create the workflow file that contains our logic. Under .github/workflows, create a new file named port-slack-reminder.yml and use the following snippet as its content:
Github workflow (click to expand)
# port-slack-reminder.yml

name: Generate Scorecards Reminders
on:
workflow_dispatch:
inputs:
port_payload:
required: true
type: string
jobs:
generate-scorecards-reminders:
runs-on: ubuntu-latest
steps:
- name: Generate Scorecards Reminders
uses: port-labs/port-sender@v0.2.3
with:
operation_kind: scorecard_reminder
port_client_id: ${{ secrets.PORT_CLIENT_ID }}
port_client_secret: ${{ secrets.PORT_CLIENT_SECRET }}
slack_webhook_url: ${{ secrets.SLACK_WEBHOOK_URL }}
blueprint: service
scorecard: ProductionReadiness
target_kind: slack
- name: Report status to Port
uses: port-labs/port-github-action@v1
with:
clientId: ${{ secrets.PORT_CLIENT_ID }}
clientSecret: ${{ secrets.PORT_CLIENT_SECRET }}
operation: PATCH_RUN
runId: ${{ fromJson(inputs.port_payload).context.runId }}
logMessage: |
Slack reminder sent successfully 🚀
Port Initiatives sender Github action

This workflow uses Port's Initiatives Sender GitHub Action to send a Slack message.


All done! The action is ready to be used 🚀


Execute the action

After creating an action, it will appear under the Self-service tab of your Port application:

  1. Click on Create to begin executing the action.

  2. Click Execute. A small popup will appear, click on View details:



  1. This page provides details about the action run. As you can see, the backend returned Success and the repo was successfully created:
Logging action progress

💡 Note the Log stream at the bottom, this can be used to report progress, results and errors. Click here to learn more.


  1. You can now enter your Slack channel and view the scorecard reminder:

Congratulations! You can now send send Slack reminders easily from Port 💪🏽

Conclusion

Creating scorecards is the first step in setting standards in our development lifecycle. However, to ensure these standards are met, we need to turn rule violations into action items. By automating Slack reminders and the creation of Jira tasks, we can drive change across the entire organization using familiar tools to combine it natively within our delievery lifecycle.

More Examples