Skip to content

A GitHub Action that automates the comparison of Amazon Connect contact flow versions and generates visual HTML reports of flow changes.

License

Notifications You must be signed in to change notification settings

aws-samples/connect-contact-flow-comparison-github-action

Contact Flow Comparison Action Setup Guide

Overview

This guide explains how to use the Contact Flow Comparison GitHub Action - a tool designed to monitor and compare changes in Amazon Connect contact flows. The workflow automatically runs whenever changes are made to contact flow files in your specified directory and pushed into Github. Upon running, it compares the current version of the contact flows with the previous version. Results are provided as HTML files in your GitHub Actions workflow artifacts. These include:

  • A main index page linking to individual flow comparisons
  • A metrics page showing Bedrock API performance data (such as token usage, response times, and retry attempts)

Prerequisites

  • GitHub repository with Amazon Connect contact flows
  • GitHub Actions enabled in your repository
  • AWS Account with the following permissions (Note: While Bedrock inference profiles are available in a few regions, this implementation is configured for us-east-1):
  {
    "Version": "2012-10-17",
    "Statement": [
      {
        "Effect": "Allow",
        "Action": ["bedrock-runtime:InvokeModel"],
        "Resource": "arn:aws:bedrock:us-east-1:YOUR_ACCOUNT_ID:inference-profile/us.anthropic.claude-3-5-sonnet-20241022-v2:0"
      },
      {
        "Effect": "Allow",
        "Action": ["sts:GetCallerIdentity"],
        "Resource": "*"
      }
    ]
  }

Required Permissions

permissions:
id-token: write
contents: read

Required Secrets

Github_PAT: GitHub Personal Access Token with repository access

Required Variables

ACCOUNT: AWS Account ID (should be set in repository variables)

Directory Structure

Your repository should have a structure similar to:

repository/
├── imports/
│ └── resources/
│ └── flows/ # Default contact flow directory
└── [other directories]

Workflow Setup

Create a new workflow file (e.g., .github/workflows/workflow.yml)

Add the following workflow configuration:

Create a new workflow file (e.g., .github/workflows/compare-flows.yml):

name: Contact Flows Comparison Action

on:
  push:
    paths:
      - "imports/resources/flows/**"

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

permissions:
  id-token: write
  contents: read

jobs:
  compare_flows:
    name: compare
    runs-on: ubuntu-latest
    environment: dev
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 2  # Fetch the current and previous commit

      # Initial AWS Authentication
      - name: Configure AWS Credentials
        uses: aws-actions/configure-aws-credentials@v4
        with:
          role-to-assume: arn:aws:iam::YOUR_ACCOUNT_ID:role/YOUR_OIDC_ROLE
          aws-region: us-east-1

      - name: Run Compare Action
        uses: aws-samples/connect-contact-flow-comparison-github-action@main
        env:
          ENVIRONMENT: dev
        with:
          github_pat: ${{ secrets.FLOW_COMPARE_PAT }}
          repo_owner: YOUR_GITHUB_USERNAME
          repo: YOUR_REPOSITORY_NAME
          commit_sha: ${{ github.sha }}
          contact_flow_path: ${{ vars.CONTACT_FLOW_PATH }}

Configuration Parameters

Action Inputs

Input Description Required
github_pat GitHub Personal Access Token Yes
repo_owner Owner of the repository Yes
repo Repository name Yes
commit_sha Commit SHA for comparison Yes
contact_flow_path Path to contact flow files Yes

Usage

Set up the required secrets in your GitHub repository:

  • Go to Settings > Secrets and Variables > Actions
  • Add required secrets (FLOW_COMPARE_PAT)

Set up repository variables:

  • Add required variables (ACCOUNT)

The workflow will automatically trigger when:

  • Changes are pushed to files in the specified contact flow path

The action will compare contact flows between the current and previous commit

Results will be html pages available in the GitHub Actions workflow run as an artifact

  • index.html will link to all of the individual flows
  • bedrock_metrics.html will show various metrics from bedrock including token usage, latencies, retries, etc.,

Notes

  • Ensure your contact flows are in the correct format and location
  • Make sure AWS credentials are properly configured
  • While Amazon Bedrock inference profiles are available in a few regions, this implementation is configured to use us-east-1. To use a different region, you will need to modify the Bedrock ARN in the code and IAM permissions accordingly.

Example of a simple contact flow change

[example]

Contributing

Contributing

License

License

About

A GitHub Action that automates the comparison of Amazon Connect contact flow versions and generates visual HTML reports of flow changes.

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages