Skip to content

+ automatically refresh README screenshots - #8

Merged
Hawkynt merged 1 commit into
mainfrom
feat/automatic-readme-screenshots
Sep 2, 2026
Merged

+ automatically refresh README screenshots#8
Hawkynt merged 1 commit into
mainfrom
feat/automatic-readme-screenshots

Conversation

@Hawkynt

@Hawkynt Hawkynt commented Sep 1, 2026

Copy link
Copy Markdown
Owner

What changed

  • added a cheap Generate workflow for every non-main working-branch push
  • reuse the existing Avalonia headless screenshot tests instead of introducing another rendering path
  • validate both generated PNGs before committing them back to the branch
  • commit changed screenshots through Hawkynt/RepositoryTemplate/commit-generated-file@v1, preserving signed-commit branch protection
  • explicitly dispatch CI when generation advances a branch that already has an open PR

Design

The screenshot implementation already existed in ReadmeScreenshotTests; the missing piece was automatic pre-PR generation. This mirrors the established MassMediaEdit / RepositoryTemplate generated-file pattern and keeps full PR CI focused on verification rather than producing an uncommitted artifact.

Validation

  • Generate workflow run 33474507780: success
  • existing screenshot test: success
  • PNG signature validation: success
  • generated-file commit steps: success
  • generated-head CI dispatch logic: success

References

  • GitHub Actions event behavior for GITHUB_TOKEN-created commits and explicit workflow_dispatch
  • Hawkynt/RepositoryTemplate/commit-generated-file@v1
  • Hawkynt/MassMediaEdit/.github/workflows/generate.yml

No new dependencies.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f007db3939

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

GH_TOKEN: ${{ github.token }}
run: |
branch="$GITHUB_REF_NAME"
generated_head=$(gh api "repos/$GITHUB_REPOSITORY/branches/$branch" --jq '.commit.sha')

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Encode branch names before querying the generated head

On branches containing /—for example, the common feature/screenshots naming pattern—gh api sends this interpolated value as multiple URL path segments, while GitHub's Get a branch endpoint expects the branch name as one encoded path parameter. The lookup therefore returns 404 and the Generate job fails before it can dispatch CI; if screenshots were committed with GITHUB_TOKEN, that generated head receives no automatic CI run. Percent-encode branch before constructing this endpoint or obtain the head SHA without embedding the raw ref in the path; gh api --help likewise describes placeholder substitution, not automatic encoding of manually interpolated endpoint components (CLI manual).

Useful? React with 👍 / 👎.

@Hawkynt
Hawkynt force-pushed the feat/automatic-readme-screenshots branch from f007db3 to ba6b6bd Compare September 2, 2026 07:08
@Hawkynt
Hawkynt merged commit 1013312 into main Sep 2, 2026
6 checks passed
@Hawkynt
Hawkynt deleted the feat/automatic-readme-screenshots branch September 2, 2026 07:16
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