Interview Prep/GitHub Actions/Security Hardening & Supply Chain

Your OSS project needs to run tests on fork PRs and post coverage comments. Design it safely.

AdvancedScenarioSecurity Hardening & Supply Chain
Answer

Situation read → Untrusted code must run without secrets; commenting needs write access.

What I'd do →

  1. ci.yml on pull_request: run tests, write coverage.json and the PR number to an artifact. No secrets, read-only token.
  2. comment.yml on workflow_run (CI completed): download the artifact with run-id, validate PR number is an integer and the JSON schema, render the comment, post with pull-requests: write.
  3. Never execute anything from the artifact; never check out the PR head in comment.yml.

Why → Splits untrusted execution from privileged writing, with only data crossing the boundary.

Interview tip → Name it "the two-workflow pattern" and mention artifact validation.

All GitHub Actions questions Roadmap: GitHub Actions

More on Security Hardening & Supply Chain