Skip to content

Commit 38bedda

Browse files
author
Pat
authored
workflows: update to post comment on perf test PRs (fluent#5660)
* workflows: update to post comment on perf test PRs Signed-off-by: Patrick Stephens <[email protected]> * workflows: fixes for multiline file handling Signed-off-by: Patrick Stephens <[email protected]>
1 parent 0c41d2b commit 38bedda

File tree

1 file changed

+33
-9
lines changed

1 file changed

+33
-9
lines changed

.github/workflows/pr-perf-test.yaml

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,25 +35,49 @@ jobs:
3535
- uses: actions/download-artifact@v3
3636

3737
- name: Upload plots to CML
38-
continue-on-error: true
3938
run: |
39+
docker pull -q dvcorg/cml-py3:latest
4040
for FILE in *.png; do
4141
echo "Handling $FILE"
4242
docker run --rm -t \
4343
-v $PWD:/output:rw \
4444
dvcorg/cml-py3:latest \
45-
/bin/sh -c "cml-publish /output/$FILE $DEFAULT_SETTINGS --md --title=$FILE >> /output/report.md"
45+
/bin/sh -c "cml-publish /output/$FILE --driver=github --repo=${{ github.repository }} --md --title=$FILE >> /output/report.md"
4646
done
47-
cat report.md
48-
docker run --rm -t \
49-
-v $PWD/report.md:/report.md:ro \
50-
-e GITHUB_TOKEN="${{ secrets.GITHUB_TOKEN }}" \
51-
dvcorg/cml-py3:latest \
52-
/bin/sh -c "cml-send-comment /report.md $DEFAULT_SETTINGS --commit-sha=${{ github.sha }}"
5347
shell: bash
5448
working-directory: output
49+
50+
- name: Dump markdown to variable
51+
id: report
52+
run: |
53+
file_test_newlines=""
54+
while read line
55+
do
56+
file_test_newlines+=" $line"
57+
done < report.md
58+
echo "::set-output name=report::$file_test_newlines"
59+
shell: bash
60+
working-directory: output
61+
62+
- uses: actions/github-script@v6
63+
if: github.event_name == 'pull_request'
5564
env:
56-
DEFAULT_SETTINGS: "--driver=github --repo=${{ github.repository }}"
65+
REPORT: "Plots\n${{ steps.report.outputs.report }}"
66+
with:
67+
github-token: ${{ secrets.GITHUB_TOKEN }}
68+
script: |
69+
const output = `#### Performance Test
70+
Run URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
71+
<details><summary>Show Performance Results</summary>
72+
${process.env.REPORT}
73+
</details>
74+
*Pushed by: @${{ github.actor }}, Action: \`${{ github.event_name }}\`*`;
75+
github.rest.issues.createComment({
76+
issue_number: context.issue.number,
77+
owner: context.repo.owner,
78+
repo: context.repo.repo,
79+
body: output
80+
})
5781
5882
pr-perf-test-complete:
5983
# Only runs on success

0 commit comments

Comments
 (0)