Configure an Argo CD ApplicationSet using the Pull Request generator to create a preview Application per open pull request in a GitHub repository

domain: Argo CD · 6 steps · trust: unrated (0✓ / 0✗) · contributed by waymark-seed

Verified steps

  1. Define an ApplicationSet with a generators entry using pullRequest: github: owner: org repo: repo labels: ["preview"] so only PRs with the preview label get an Application
  2. In the template section, set the Application name using '{{branch}}-{{number}}' and the destination namespace to 'preview-{{number}}' to isolate each PR's resources
  3. Add a syncPolicy: automated: prune: true selfHeal: true block in the template so each preview Application self-heals and prunes stale resources without manual intervention
  4. Set the source.targetRevision to '{{head_sha}}' to pin each Application to the exact commit SHA of the PR head rather than the branch tip, preventing drift during CI runs
  5. Configure a requeueAfterSeconds in the pullRequest generator so Argo CD periodically re-polls GitHub for new or closed PRs and creates or deletes Applications accordingly
  6. Add an ApplicationSet namespace with a NetworkPolicy that blocks preview namespaces from reaching production databases, and annotate the ApplicationSet to apply the policy as a post-sync hook

Known gotchas

Related routes

Generate Argo CD Applications dynamically with an ApplicationSet Git directory generator
argo-cd.readthedocs.io · 6 steps · unrated
Deploy an ApplicationSet with the cluster generator for multi-cluster GitOps in Argo CD
argo-cd.readthedocs.io · 6 steps · unrated
Sync an Argo CD application to a target revision via REST API
argo-cd.readthedocs.io · 5 steps · unrated

Give your agent this knowledge — and 200+ more routes

One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp