fix breaking chars through env var sub instead of direct sub log back in console the comment fix: sanitize input through env var step add env step sanity check env remove env dump remove extra step add debugging steps Reviewed-on: #6 Co-authored-by: GregoryDosh <authentik@gregorydosh.com> Co-committed-by: GregoryDosh <authentik@gregorydosh.com>
43 lines
1.1 KiB
Markdown
43 lines
1.1 KiB
Markdown
# action-pr-comment
|
|
An action to add or update an existing comment anchored in a PR for test results, status messages, etc.
|
|
|
|
## Example
|
|
```yaml
|
|
name: Some Workflow
|
|
|
|
on:
|
|
pull_request:
|
|
|
|
jobs:
|
|
some-workflow:
|
|
name: Send PR Comment
|
|
if: ${{ !contains(github.event.head_commit.message, '[skip-ci]') }}
|
|
runs-on: ubuntu-act-latest
|
|
steps:
|
|
|
|
- name: Validate
|
|
id: validate
|
|
shell: bash
|
|
run: |
|
|
some-validation-step arg1 arg2 ... 2>&1 | tee validate.json
|
|
export SOME_ENV_VAR=$(cat validate.json | sed -z 's/\n/\\n/g')
|
|
echo "SOME_ENV_VAR=\"$SOME_ENV_VAR\"" >> $GITHUB_OUTPUT
|
|
|
|
- name: Post/Update PR Comment
|
|
if: always()
|
|
uses: https://git.auengun.net/homelab/action-pr-comment@main
|
|
with:
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
comment: |
|
|
#### Validation 🤖 \`${{ steps.validate.outcome }}\`
|
|
<details open>
|
|
<summary>Shell Output</summary>
|
|
|
|
\`\`\`json\n
|
|
${{ fromJSON(steps.validate.outputs.SOME_ENV_VAR) }}
|
|
\`\`\`
|
|
|
|
</details>
|
|
|
|
*Commit: ${{ github.sha }}*
|
|
```
|