cd /news/ai-tools/devsecops-ai-workflow-prompt · home topics ai-tools article
[ARTICLE · art-91870] src=gist.github.com ↗ pub= topic=ai-tools verified=true sentiment=· neutral

DevSecOps AI Workflow Prompt

A developer has outlined a workflow that automates AI-powered security analysis on GitHub pull requests, posting summarized reports as comments. The process fetches changed files, scans for vulnerabilities like hardcoded secrets and injection flaws, and generates a Markdown report with severity ratings and recommendations. The workflow emphasizes secure handling of GitHub tokens and idempotent comment posting.

read1 min views1 publishedAug 11, 2026

Goal: Build an automated AI workflow that performs security analysis on every GitHub Pull Request and posts a summarized report back as a PR comment.

Workflow Steps:

Setup Trigger:

Configure GitHub Pull Request trigger

Events:
    opened
    synchronize
    reopened

Ensure webhook is registered with the repository

Extract PR Data:
From webhook payload:

Repository owner
Repository name
Pull Request number

Fetch Changed Files:

Use GitHub API:
GET /repos/{owner}/{repo}/pulls/{pull_number}/files

Authentication:
    Retrieve GitHub PAT securely from workspace secrets
    Example: GITHUB_TOKEN

For each file:
    Filename
    Patch (diff)
    Status (added/modified/removed)

Skip:
    Binary files
    Files exceeding size threshold

AI Security Analysis:
Analyze each changed file for:

Hardcoded secrets (API keys, tokens, credentials)
Injection vulnerabilities (SQL, command, etc.)
Unsafe deserialization
Authentication/authorization flaws
Sensitive data leaks
OWASP Top 10 risks

For each issue, produce:

Severity (Low / Medium / High / Critical)
Description
Affected snippet (from diff)
Recommended fix

Aggregate Results:

Total issues by severity
File-wise breakdown
Highlight critical/high issues

Generate PR Comment (Markdown):

🔐 AI Security Scan Report

Summary:

Critical: X
High: X
Medium: X
Low: X

Findings:

File: <filename>
    Issue: <description>
    Severity: <level>
    Recommendation: <fix>

Overall Recommendation:

✅ Approve
⚠️ Needs Fixes
❌ Block Merge

Post Comment to PR:

GitHub API:
POST /repos/{owner}/{repo}/issues/{pull_number}/comments

Authentication:
    Use GitHub PAT from workspace secrets (GITHUB_TOKEN)
    Do NOT hardcode or expose the token

Constraints:

Never expose secrets in logs or outputs
Ensure idempotency (avoid duplicate comments)
Handle large PRs efficiently
Respect API rate limits

Output: "Security scan completed and comment posted successfully."

── more in #ai-tools 4 stories · sorted by recency
── more on @github 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/devsecops-ai-workflo…] indexed:0 read:1min 2026-08-11 ·