Skip to content

Automated PR creation for templates updates.#423

Open
Kaniska244 wants to merge 1 commit into
devcontainers:mainfrom
Kaniska244:template-automation-pr
Open

Automated PR creation for templates updates.#423
Kaniska244 wants to merge 1 commit into
devcontainers:mainfrom
Kaniska244:template-automation-pr

Conversation

@Kaniska244

@Kaniska244 Kaniska244 commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds an automated workflow that detects when the image variants referenced by templates in this repo have drifted from the tags actually published by devcontainers/images, opens (or refreshes) a single tracking issue with the comparison report, and assigns it to the GitHub Copilot coding agent to prepare the fix. Also adds an AGENTS.md guide so AI agents know exactly how to bring templates back in sync.

Motivation

When devcontainers/images adds or removes an image variant, the matching template's options.imageVariant.proposals can silently fall out of date. This PR turns that drift into an actionable, auto-assigned tracking issue so it gets picked up and fixed promptly instead of being missed.

Changes

File Change
.github/workflows/check-image-tags.yaml New report-drift-issue job. Runs only on schedule / workflow_dispatch (never on PRs/pushes), checks out the last released tag of devcontainers/images, runs build/check-image-tags.ts, strips ANSI colour codes, detects MISSING / UNUSED drift, and on drift runs build/report-drift-issue.sh. Uses secrets.PAT (not GITHUB_TOKEN) so the Copilot coding agent is reliably triggered by the assignment; requires issues: write.
build/report-drift-issue.sh New script that parses the checker report, builds a readable issue body (MISSING / UNUSED sections + collapsible full report), ensures the automated-image-sync label exists, creates or refreshes a single open tracking issue, and assigns it to the Copilot coding agent (copilot-swe-agent) via GraphQL. Warns and exits gracefully if the agent isn't assignable.
AGENTS.md New guidance for AI coding agents: repo overview, conventions, how templates reference images, and step-by-step rules for syncing proposals/default with devcontainers/images (ordering conventions, version bumping, validation).
.gitignore Ignore the local /images/ clone used by build/check-image-tags.ts; also add the missing trailing newline.

How it works

  1. The scheduled Compare Templates against Images workflow compares template image references against the latest published images.
  2. If any tags are classified MISSING (referenced but no longer published) or genuinely new UNUSED variants exist, a tracking issue titled “Sync template image variants with devcontainers/images” is created or refreshed.
  3. The issue is assigned to the Copilot coding agent, which follows AGENTS.md to update the affected templates, bump each edited template's version, and validate until there are no MISSING tags.

Requirements / Notes

  • A PAT secret with issues: read and write must be configured, and the Copilot coding agent must be enabled for the repository so it appears as an assignable actor. If it isn't assignable, the issue is created but left unassigned with a warning.
  • The drift job does not run on pull requests or pushes, so no issues are opened for in-flight changes.
  • No templates are modified in this PR — it only adds the automation and documentation.

Testing

  • report-drift-issue can be exercised manually via workflow_dispatch.
  • Locally: clone devcontainers/images, then run npx tsx build/check-image-tags.ts ../images to reproduce the report the workflow consumes.
  • Tested in locally forked repository and it created issue and auto assigned to copilot coding agent which ultimately led to PR creation. Compared the content of the PR which appears to be correct.

@Kaniska244 Kaniska244 marked this pull request as ready for review June 30, 2026 09:15
@Kaniska244 Kaniska244 requested a review from a team as a code owner June 30, 2026 09:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant