Skip to content

Add soft-gate PR risk scan automation for agentic PRs#1969

Open
aaronpowell wants to merge 9 commits into
stagedfrom
aaronpowell/pr-risk-scanning
Open

Add soft-gate PR risk scan automation for agentic PRs#1969
aaronpowell wants to merge 9 commits into
stagedfrom
aaronpowell/pr-risk-scanning

Conversation

@aaronpowell

Copy link
Copy Markdown
Contributor

Pull Request Checklist

  • I have read and followed the CONTRIBUTING.md guidelines.
  • I have read and followed the Guidance for submissions involving paid services.
  • My contribution adds a new instruction, prompt, agent, skill, or workflow file in the correct directory.
  • The file follows the required naming convention.
  • The content is clearly structured and follows the example format.
  • I have tested my instructions, prompt, agent, skill, or workflow with GitHub Copilot.
  • I have run npm start and verified that README.md is up to date.
  • I am targeting the staged branch for this pull request.

Description

This adds a non-blocking supply-chain risk signal for PRs that touch agentic contribution paths. The goal is to surface risky patterns early (guardrail bypass language, remote shell execution, dynamic package execution, and skill script additions) without blocking contributor flow.

The change introduces a scanner script (eng/pr-risk-scan.mjs) plus two GitHub workflows. The gate workflow scans changed PR files and uploads a structured artifact (results.json + report.md). A follow-on comment workflow runs with write permissions, reads only that artifact, and upserts a single marker-based PR comment containing severity counts and a findings table.

The workflows are intentionally soft-gate in v1: findings are visible and repeatable, but do not fail the PR. This keeps false-positive tuning practical before any stricter enforcement.


Type of Contribution

  • New instruction file.
  • New prompt file.
  • New agent file.
  • New plugin.
  • New skill file.
  • New agentic workflow.
  • Update to existing instruction, prompt, agent, plugin, skill, or workflow.
  • Other (please specify): new repository automation script in eng/.

Additional Notes

  • Added files:
    • .github/workflows/pr-risk-scan.yml
    • .github/workflows/pr-risk-scan-comment.yml
    • eng/pr-risk-scan.mjs
  • The comment format uses marker <!-- pr-risk-scan-results --> to ensure idempotent updates.
  • Initial preview runs show useful skill-script-added signal and one noisy unpinned-version match, which we can tighten in a follow-up.

By submitting this pull request, I confirm that my contribution abides by the Code of Conduct and will be licensed under the MIT License.

Introduce a PR risk scanner script plus two workflows: one to scan changed files and upload findings, and one to upsert a sticky PR comment with a summary table and findings. This adds non-blocking supply-chain risk visibility for agentic contributions.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 11, 2026 04:38
@github-actions github-actions Bot added new-submission PR adds at least one new contribution workflow PR touches workflow automation labels Jun 11, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new “soft-gate” PR automation that scans agentic contribution paths for supply-chain / unsafe-execution patterns, uploads a structured results artifact, and posts (or updates) an idempotent PR comment summarizing findings.

Changes:

  • Introduces eng/pr-risk-scan.mjs to scan changed files for a small set of risk heuristics and emit results.json + report.md.
  • Adds a PR gate workflow to run the scanner and upload the results artifact.
  • Adds a follow-on workflow_run workflow to download the artifact and upsert a marker-based PR comment.
Show a summary per file
File Description
eng/pr-risk-scan.mjs Implements the risk scan rules, report generation, and JSON output.
.github/workflows/pr-risk-scan.yml Runs the scanner on relevant PRs and uploads the scan artifact.
.github/workflows/pr-risk-scan-comment.yml Downloads the artifact and upserts a single PR comment with the report.

Copilot's findings

  • Files reviewed: 3/3 changed files
  • Comments generated: 2

Comment thread eng/pr-risk-scan.mjs
Comment thread eng/pr-risk-scan.mjs

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot's findings

  • Files reviewed: 3/3 changed files
  • Comments generated: 6

Comment thread eng/pr-risk-scan.mjs Outdated
Comment thread eng/pr-risk-scan.mjs Outdated
Comment thread eng/pr-risk-scan.mjs
Comment thread .github/workflows/pr-risk-scan.yml
Comment thread .github/workflows/pr-risk-scan-comment.yml
Comment thread .github/workflows/pr-risk-scan-comment.yml
aaronpowell and others added 3 commits June 11, 2026 15:51
Reject absolute paths, enforce repo-root containment after resolution, and tighten unpinned-version detection to dependency/version contexts to avoid markdown noise.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot's findings

  • Files reviewed: 3/3 changed files
  • Comments generated: 2

Comment thread eng/pr-risk-scan.mjs Outdated
Comment thread eng/pr-risk-scan.mjs Outdated
aaronpowell and others added 2 commits June 12, 2026 12:02
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot's findings

  • Files reviewed: 3/3 changed files
  • Comments generated: 3

Comment thread eng/pr-risk-scan.mjs Outdated
Comment thread eng/pr-risk-scan.mjs Outdated
Comment thread .github/workflows/pr-risk-scan-comment.yml Outdated
aaronpowell and others added 3 commits June 12, 2026 12:20
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot's findings

  • Files reviewed: 3/3 changed files
  • Comments generated: 3

Comment thread eng/pr-risk-scan.mjs
Comment on lines +208 to +217
function scanSkillScriptPath(filePath, findings) {
const normalized = filePath.replace(/\\/g, "/");
if (!normalized.startsWith("skills/")) {
return;
}

const extension = path.extname(normalized).toLowerCase();
if (!SCRIPT_EXTENSIONS.has(extension)) {
return;
}
Comment on lines +46 to +51
- name: Upload scan artifact
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7
with:
name: pr-risk-scan-results
path: pr-risk-results/
retention-days: 1
Comment on lines +15 to +18
permissions:
contents: read
actions: read

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new-submission PR adds at least one new contribution workflow PR touches workflow automation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants