feat: add comment-body output#148
Conversation
23a59fe to
7f0947e
Compare
|
This is what I was concerned with by bumping the actions version: Size Change: +132 kB (+325.89%) 🆘 Total Size: 173 kB 📦 View Changed
Ideally want to avoid such a blow up, even for something that just runs as an action. At the very least, much harder to audit. |
|
This size increase is caused by the circular dependencies in
I tested this locally with Test Workflowname: Test comment-body
on:
pull_request:
push:
permissions:
contents: read
issues: write
pull-requests: write
jobs:
test:
name: job
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- id: compressed-size
uses: ./
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
base-ref: master
pattern: index.js
comment-key: output-smoke
- name: Print comment-body output
env:
COMMENT_BODY: ${{ steps.compressed-size.outputs.comment-body }}
run: |
if [ -z "$COMMENT_BODY" ]; then
echo "comment-body output is empty" >&2
exit 1
fi
printf '%s\n' "$COMMENT_BODY"
If bundle size is a concern, I’d prefer to implement a lightweight For example export function setOutput(name, value) {
const outputPath = process.env.GITHUB_OUTPUT;
if (outputPath) {
const delimiter = `ghadelimiter_${Date.now()}`;
fs.appendFileSync(outputPath, `${name}<<${delimiter}${EOL}${value}${EOL}${delimiter}${EOL}`);
return;
}
console.log(
`::set-output name=${name}::${String(value).replace(/\n/g, '%0A').replace(/\r/g, '%0D')}`
);
} |
|
Circular dependencies just result in (some) tools throwing a warning, it has no bearing whatsoever on final bundle size. Treeshaking is also less of an issue compared to plain bundle bloat that's been allowed to occur over there but 🤷 You can try pinning |
It's nice to know this 👍
Yes, it is based on the implementation from core, with some simplified handling for name and value edge cases. |
7f0947e to
b1bc5fe
Compare
b1bc5fe to
78ecac6
Compare
This comment was marked as resolved.
This comment was marked as resolved.
|
Any progress will be reported here. It's on my todo list, I'll get to it when I can. Thanks for bearing with me. |

Releted: #2 (comment)
Write the results to
outputsso downstream workflows can manage comments on their own. For example, the results can be uploaded as artifacts, and aworkflow_runwith write permissions can then post comments on PRs from forks.Compressed Size Comment Body
Compressed Size Comment Post