-
-
Notifications
You must be signed in to change notification settings - Fork 0
chore: unwrap Markdown prose #85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| --- | ||
| # Rewrites a hard-wrapped pull request body rather than reporting it, and after | ||
| # a rewrite deletes any report prose-body.yml left. The report cannot withdraw | ||
| # its own: GitHub starts no workflow run for an event caused by its own | ||
| # `GITHUB_TOKEN`, so nothing tells it the body has changed. | ||
| # | ||
| # Only on open, reopen and ready-for-review. Running it on every push would | ||
| # overwrite whatever the author had typed since. Drafts are not edited, which | ||
| # is what `ready_for_review` is here for. | ||
| # | ||
| # `pull_request_target` is the only trigger this one accepts, and it is why the | ||
| # file has to be on the default branch: under `pull_request` the workflow file | ||
| # would come from the pull request itself, and that file is what grants the | ||
| # token. It checks out nothing. A consequence worth knowing when editing it -- | ||
| # a pull request cannot try this out; it takes effect once merged. | ||
| # | ||
| # Unlike a file, a body carries no evidence of intent: there is no hard-break | ||
| # marker to distinguish a break the author wanted from one their editor made, | ||
| # so this can join a break that was meant to stay. `<!-- unwrap-ignore -->` on | ||
| # the line above a paragraph keeps it. | ||
| name: Prose body write | ||
|
|
||
| on: | ||
| pull_request_target: | ||
| types: [opened, reopened, ready_for_review] | ||
|
|
||
| jobs: | ||
| edit: | ||
| permissions: | ||
| pull-requests: write | ||
| uses: michen00/markdown-prose-hooks/.github/workflows/unwrap-pr-body.yml@v0.4.0 |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| --- | ||
| # Reports a hard-wrapped pull request body. GitHub renders every newline in a | ||
| # body as a `<br>`, so a body wrapped in an editor or a heredoc reaches readers | ||
| # at whatever width it was typed to. A file has the opposite problem -- the | ||
| # break renders as a space and costs a reflowed diff -- and the pre-commit hook | ||
| # covers that side. | ||
| # | ||
| # Deliberately narrower than the upstream example, which also carries `opened` | ||
| # and `reopened`. Those belong to prose-body-write.yml: sharing an event fires | ||
| # both at once, and this report would then describe a body the rewrite is about | ||
| # to replace. `edited` is not in the default type set and is the one that | ||
| # matters -- editing a body fires it alone, so without it a report would stand | ||
| # on a body the author has already fixed. | ||
| # | ||
| # `pull_request_target`, not `pull_request`, and the difference is who the | ||
| # report reaches. A fork's token is read-only whatever a caller's | ||
| # `permissions:` block asks for, so under `pull_request` the comment is refused | ||
| # for every outside contributor -- the people least likely to know this | ||
| # repository's prose convention, and the ones the report exists for. The run | ||
| # does not fail there and the report is not lost: the reusable workflow falls | ||
| # back to the job summary. But a summary is something you have to open a check | ||
| # to find, and a comment is not. | ||
| # | ||
| # What makes that safe here is that the reusable workflow checks out nothing -- | ||
| # it has no `actions/checkout` step at all. It reads the body from the event | ||
| # payload and posts a comment, so the usual `pull_request_target` hazard, a | ||
| # writable token handed to unreviewed code, has nothing to attach to. Keep it | ||
| # that way: adding a checkout of the pull request head under this trigger is | ||
| # what would turn it into the vulnerability the pattern is known for. | ||
| # | ||
| # The cost is the same one prose-body-write.yml pays. `pull_request_target` | ||
| # reads the workflow from the default branch, so a pull request cannot test a | ||
| # change to this file; it takes effect once merged. | ||
| name: Prose body | ||
|
|
||
| on: | ||
| pull_request_target: | ||
| types: [synchronize, edited] | ||
|
|
||
| jobs: | ||
| report: | ||
| # The reusable workflow declares no permissions of its own; only the | ||
| # comment needs one, and the scope belongs on the calling job. | ||
| permissions: | ||
| pull-requests: write | ||
| uses: michen00/markdown-prose-hooks/.github/workflows/unwrap-pr-body-check.yml@v0.4.0 | ||
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
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
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
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.
Uh oh!
There was an error while loading. Please reload this page.