Skip to content

Add flux-update-pr action - #1

Open
fschoell wants to merge 7 commits into
mainfrom
feat/flux-update-pr
Open

fschoell wants to merge 7 commits into
mainfrom
feat/flux-update-pr

Conversation

@fschoell

@fschoell fschoell commented Oct 5, 2026 •

Copy link
Copy Markdown

Summary

Composite action for the k8s-* repos at actions/flux-update-pr. Flux ImageUpdateAutomation finds the new tag and pushes the bump to a branch; the action turns that branch into a PR that operators can judge without leaving GitHub.

  • Reads the changed $imagepolicy setters from the branch diff against main.
  • Lists the upstream release notes for every release between the old and new version.
  • Pulls the releases' deploy / upgrade / migration / behavior-change sections into a Before merging block at the top, and warns when notes announce a breaking change.
  • Assignees, reviewers and labels are configured per component in .github/flux-updates.yaml of the calling repo.
  • Supports charts whose changelog follows appVersion (version: appVersion + chart:), e.g. the NATS case in k8s-opstrom.
  • Only rewrites the body between its markers, so human notes on the PR survive later Flux pushes.
  • Optional summarize: the Copilot CLI writes a verdict and action items per component, authenticated with the workflow token (copilot-requests: write) and billed to the org. It replaces the Before merging section, which stays the fallback when summarizing is off or fails. The CLI runs with no tools allowed, in an empty directory, without custom instructions or MCP servers.
  • @mentions in quoted release notes and in the summary are defanged, so these PRs don't notify upstream contributors.

Layout: action.yml runs actions/github-script on index.js (GitHub API, git, helm); the logic that decides what goes in the PR is in lib.js as pure functions with node:test tests, run by .github/workflows/test-actions.yaml. No build step or dist/. Docs: actions/flux-update-pr/README.md.

Test plan

  • node --test 'actions/**/*.test.js' (19 tests: diff parsing, tag extraction, component matching, release selection and SemVer precedence, upstream tag resolution, deploy-section extraction incl. code fences, body merge, titles, body size budget, summary input/sanitizing/rendering, mention defanging)

  • Local dry run of index.js against a simulated Flux branch (create and no-op)

  • End to end in k8s-cloud-backend on throwaway branches: pinax-network/k8s-cloud-backend#199 was created with the release notes, the Before merging section and fschoell assigned. A note added to the body survived a re-push and the title followed the new version. PAT_INTERNAL_REPOSITORIES reads the private release notes. Closed, branches deleted.

  • Summarize end to end: pinax-network/k8s-cloud-backend#201 got a Copilot CLI summary (verdict Needs config or secret change, 5 action items, each checked against the release notes and citing the right release). Fallback tested locally for CLI error, CLI missing and summarize off. Closed, branches deleted.

fschoell and others added 3 commits October 5, 2026 16:20
Turns a Flux ImageUpdateAutomation push branch into a PR carrying the
upstream release notes, a Before merging section built from their
deploy/upgrade notes, and per-component assignees and reviewers.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The logic moves out of an inline github-script string into index.js
(GitHub API, git, helm) and lib.js (pure functions) with node:test unit
tests and a CI workflow. Callers now own their trigger, checkout,
permissions and concurrency, and get the PR number and URL as outputs.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@fschoell fschoell changed the title Add flux-update-pr reusable workflow Add flux-update-pr action Oct 6, 2026
Node 24 treats a directory argument as a module path.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Release processing can omit deployment instructions, and oversized generated bodies can prevent PR creation or updates.

Review effort: Balanced
Findings: 1 High severity · 4 Medium severity

Open (5)
What changed in this PR

Adds a reusable action that turns Flux update branches into operator-reviewable PRs in the k8s repositories.

Changes:

  • Collects release history, deployment instructions and breaking-change warnings.
  • Supports per-component assignments, chart appVersions and preservation of human notes.
  • Adds documentation, unit tests and a test workflow.
File Description
actions/​flux-update-pr/​README.md Documents usage and component configuration.
actions/​flux-update-pr/​lib.test.js Tests parsing, release selection and rendering.
actions/​flux-update-pr/​lib.js Implements parsing and PR-content helpers.
actions/​flux-update-pr/​index.js Fetches releases and creates or updates PRs.
actions/​flux-update-pr/​action.yml Defines action inputs, outputs and execution.
.github/​workflows/​test-actions.yaml Runs action unit tests.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread actions/flux-update-pr/lib.js Outdated
Comment thread actions/flux-update-pr/index.js Outdated
Comment thread actions/flux-update-pr/index.js Outdated
Comment thread actions/flux-update-pr/lib.js Outdated
Comment thread actions/flux-update-pr/lib.js
fschoell and others added 3 commits October 6, 2026 14:24
- Budget the whole PR body: deploy notes and release bodies expand while
  they fit (deploy notes first) and fall back to links; the limit leaves
  room for text people wrote around the managed block.
- Read every release page; the API lists by creation date, so a
  backport can follow any number of newer releases.
- Build compare links from the upstream tags that exist, so appVersions
  without a v prefix don't link to missing refs.
- Order prereleases by SemVer rules (numeric identifiers first).
- Ignore # lines inside fenced code blocks when extracting sections.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
With summarize: true, the release notes go to GitHub Models and its
verdict and action items replace the Before merging section. That
section remains the fallback when summarizing is off, the call fails,
or the notes are too long, so the body holds one or the other.

Mentions in model output and quoted release notes are defanged so the
PRs don't notify upstream contributors.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
GitHub Models was retired on 2026-07-30. The summary now comes from the
Copilot CLI, authenticated with the workflow token through the
copilot-requests: write permission and billed to the organization.

The CLI runs non-interactively with no tool pre-approved, in an empty
directory, without custom instructions or built-in MCP servers. Any
failure, including a missing CLI or a disabled org policy, falls back
to the Before merging section.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Release-content sanitization can preserve stale instructions, trigger unwanted mentions and corrupt copied commands.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
Resolved since last review (5)
Previously missed (1)

In code that hasn't changed since last review

Medium severity Sanitize release markers and mentions in deployment headings

actions/​flux-update-pr/​lib.js:278

Sanitize all quoted release content, including deployment headings and excerpts. Embedded <!-- flux-update-pr:end --> markers currently make the next mergeBody refresh stop early, preserving stale release or deployment instructions as human notes and accumulating them on later pushes. Deployment headings also bypass noMentions, so ## Deploy notes for @ops-team remains a live mention in both expanded and shortened excerpts. Strip both reserved markers from headings, excerpts and full bodies, and defang heading mentions. Add regression tests for repeated refreshes and mentions in headings.

// A zero-width space after the @ keeps the text readable without the mention. Code spans and email
// addresses are left alone.
function noMentions(text) {
return text.replace(/(^|[^\w`])@(?=[A-Za-z0-9])/g, '$1@\u200b');
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.

2 participants