Skip to content
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

Support reading from body-file #462

Merged
merged 3 commits into from
Apr 9, 2024
Merged

Support reading from body-file #462

merged 3 commits into from
Apr 9, 2024

Conversation

pbrisbin
Copy link
Member

@pbrisbin pbrisbin commented Apr 8, 2024

Closes #122.

Configured rules can now omit body, to load comment contents from a
file. The file is read the same way as the configuration: via the GitHub
API and from the default branch.

The file path will conventionally be .github/commenter/{name}.md.

If body-file is given, that is used as the complete path. If
body-file-name is given, .github/commenter/{body-file-name} is used.
The prefix is also configurable as inputs.body-file-prefix.

If the file does not exist on the default branch, the API call to read
it will error and we allow that error to bubble out as-is. We could
catch and improve the messaging, or gracefully place details of the
failure in the comment itself, but both of these have been deferred by
now. We'll start simply.

@pbrisbin pbrisbin changed the title pb/body from file Support reading from body-file Apr 8, 2024
@pbrisbin pbrisbin marked this pull request as ready for review April 8, 2024 18:56
@pbrisbin pbrisbin requested a review from a team as a code owner April 8, 2024 18:56
@pbrisbin pbrisbin requested review from danroyo and removed request for a team April 8, 2024 18:56
@pbrisbin pbrisbin force-pushed the pb/body-from-file branch from 9a08f95 to 02a04c7 Compare April 8, 2024 18:57
pbrisbin added 3 commits April 8, 2024 15:04
Configured rules can now omit `body`, to load comment contents from a
file. The file is read the same way as the configuration: via the GitHub
API and from the default branch.

The file path will conventionally be `.github/commenter/{name}.md`.

If `body-file` is given, that is used as the complete path. If
`body-file-name` is given, `.github/commenter/{body-file-name}` is used.
The prefix is also configurable as `inputs.body-file-prefix`.

If the file does not exist on the default branch, the API call to read
it will error and we allow that error to bubble out as-is. We could
catch and improve the messaging, or gracefully place details of the
failure in the comment itself, but both of these have been deferred by
now. We'll start simply.
@pbrisbin pbrisbin force-pushed the pb/body-from-file branch from 02a04c7 to 7a71761 Compare April 8, 2024 19:05
@pbrisbin pbrisbin merged commit 0d2ec16 into main Apr 9, 2024
4 checks passed
@pbrisbin pbrisbin deleted the pb/body-from-file branch April 9, 2024 15:38
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.

Allow comment body to be read from file
2 participants