[ci] offer auto-format via @github-actions format PR comment#334
Open
FlameFlag wants to merge 1 commit into
Open
[ci] offer auto-format via @github-actions format PR comment#334FlameFlag wants to merge 1 commit into
@github-actions format PR comment#334FlameFlag wants to merge 1 commit into
Conversation
When the lint workflow's Go or npm format checks fail, the bot posts a prompt inviting the repo owner or PR author to reply with `@github-actions format` A new workflow picks up the mention, runs prettier + golangci-lint --fix on the PR head, commits, pushes, then minimizes the stale prompt and (on success) the trigger comment
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When the lint workflow's Go or npm format checks fail, the bot posts a prompt inviting the repo owner or PR author to reply with
@github-actions formatA new workflow picks up the mention, runs prettier + golangci-lint --fix on the PR head, commits, pushes, then minimizes the stale prompt and (on success) the trigger comment
@asciimoo For the format-fix commit to re-trigger
PR Linton same-repo PRs, pushes must be authenticated as a GitHub App rather thanGITHUB_TOKEN(the latter intentionally does not trigger workflows, to prevent loops)Create a GitHub App for webhook uncheck Active (we don't need events), under Repository permissions give it Contents: Read & write and Pull requests: Read & write, and for "Where can this app be installed" pick Only on this account
After creation, on the App's General settings page, note the App ID (shown under "About", alongside Client ID) and click Generate a private key to download the PEM. Then in the left sidebar hit Install App -> Install next to your account -> Only select repositories -> pick
asciimoo/histerIn repo settings -> Secrets and variables -> Actions:
Variables tab -> New repository variable:
FORMAT_BOT_APP_ID= (the numeric app id)Secrets tab -> New repository secret:
FORMAT_BOT_APP_PRIVATE_KEY= (paste the full PEM contents, including the-----BEGIN/END-----lines)That's it, the workflow auto-detects these and uses them