QAPI Integration for Python Microservices

SeeR — QAPI integration with GitHub Actions for continuous impact analysis on Python projects.

This document walks you through everything you need to connect SeeR (QAPI) to a GitHub repository so that API impact analysis runs automatically on Pull Requests. It includes step‑by‑step setup, the recommended GitHub Actions workflow, secrets required, policy guidance (no shell scripts in PRs), troubleshooting, and FAQs.

Table of contents


Summary

Quick overview

  • Runs QAPI impact analysis on Pull Requests to your integration branch.

  • Publishes results as GitHub Issues with the impact-analysis label.

  • Requires a PAT, GitHub Actions workflow, and repository secrets.

Once configured, your repository will trigger SeeR's QAPI impact analysis whenever a Pull Request targets your chosen integration branch (for example develop or main). Results are published as GitHub Issues (label impact-analysis) and visible in the Actions tab.

Prerequisites

  • A GitHub repository containing your Python API code and OpenAPI specs.

  • Admin permissions (or repo settings access) to add Actions/workflows and repository secrets.

  • Basic familiarity with GitHub Actions and branching/PR workflows.


1) Create a GitHub Personal Access Token (PAT)

You will need a PAT so QAPI can interact with the repository. Create one with the scopes below.

Steps:

  1. Go to GitHub: Settings > Developer settings > Personal access tokens > Tokens (classic).

  2. Click Generate new token (classic).

  3. Add a descriptive name (for example: SeeR-QAPI-Python-integration).

  4. Set an expiration according to your security policy (recommended).

  5. Select scopes:

    • repo (Full control of private repositories)

    • workflow (Read/write GitHub Actions workflows)

    • admin:repo_hook (Manage webhooks)

    • read:org (Optional: read org metadata)

  6. Generate the token and copy it somewhere secure. You will add it to the repository secrets in Step 3.

Tip: Store the PAT in your team's password manager so it can be rotated safely.


2) Add the GitHub Actions workflow (code-impact.yml)

Create the folder .github/workflows/ (if it doesn't exist) and add code-impact.yml with the content below. Update the target branch name (e.g., develop) and secret names as required by your environment.

How this workflow works (brief)

  • Triggers on PR events targeting your integration branch.

  • Checks out the full repository history to compute diffs.

  • Runs the Qyrus impact analyzer action and waits for the analysis to publish a GitHub Issue labeled impact-analysis.


3) Configure repository secrets

In the repository: Settings > Secrets > Actions add the following secrets (names, example values, and descriptions):

Secret Name
Example Value
Description

IMPACT_API_URL

https://stg-gateway.qyrus.com:8243/impact-dispatcher/v1/analyze-impact

The endpoint for the Python Impact Analyzer service that SeeR (QAPI) communicates with.

API_ACCESS_TOKEN

Bearer 90540897-748a-3ef2-b3a3-c6f8f42022da

Your authentication token for the Qyrus gateway.

GITHUB_TOKEN

YOUR_GENERATED_PAT_FROM_STEP_1

The GitHub Personal Access Token you generated in Step 1.

WORKSPACE_NAME

MyTeamWorkspace

Your workspace name in QAPI.

SUITE_NAME

RegressionSuite

The name of the test suite in QAPI where your APIs are present.

ENVIRONMENT_NAME

Global Default

The environment name in QAPI for test execution.

USERNAME

Your username for logging into QAPI.

PASSWORD

securePassword123!

Your password for logging into QAPI.

Note: Never hard-code secrets in workflow files or source code.


Best practices & policy

⚠️ Policy: No shell scripts (.sh) in PRs

Before opening a Pull Request for QAPI integration, ensure that there are no shell scripts (files ending in .sh, e.g., start.sh) present in either the source or the target branch.

Why:

  • Security: Executable scripts in branches may run arbitrary commands and increase risk.

  • Portability: CI runners differ; workflows provide a consistent, documented environment.

  • Predictability: Centralizing build/run steps in workflow files reduces surprises during CI.

  • Risk of abuse: Shell scripts can be used to gain system access or inject malicious code (see React2Shell).

Checklist before creating a PR:


Troubleshooting

  • Problem: Workflow times out waiting for impact-analysis issue.

    • Check that the IMPACT_API_URL and API_ACCESS_TOKEN secrets are correct and reachable from the runner.

    • Inspect the Qyrus Python Impact Analysis step logs for errors.

  • Problem: Action fails to checkout or compute diffs.

    • Ensure fetch-depth: 0 is set on actions/checkout so git history is available.

  • Problem: Missing permissions to create issues.

    • Confirm the workflow permissions include issues: write and that the PAT has required scopes.


Done! SeeR (via QAPI) is Now Linked to GitHub!

Once these steps are complete:

  • Automated tests will trigger based on your workflow configuration (e.g., with every commit if you set on: push).

  • You’ll see the reports and results directly as new GitHub Issues (with the impact-analysis label) and in the GitHub Actions tab, providing immediate feedback on your code changes!

Last updated