name: Continuous Benchmarks (Comment) concurrency: group: ${{ github.workflow }}-${{ github.head_ref }} cancel-in-progress: true on: workflow_run: workflows: [ "Continuous Benchmarks (Receive)" ] types: [ completed ] jobs: comment: runs-on: ubuntu-latest permissions: actions: read contents: write pull-requests: write if: ${{ github.event.workflow_run.event == 'pull_request' }} steps: - uses: actions/checkout@v7 - name: Download Touchstone comment artifact id: download_comment uses: actions/download-artifact@v8 with: name: pr path: ./pr github-token: ${{ github.token }} repository: ${{ github.repository }} run-id: ${{ github.event.workflow_run.id }} - name: Download Touchstone plot artifact id: download_plots continue-on-error: true uses: actions/download-artifact@v8 with: name: visual-benchmarks path: ./plots github-token: ${{ github.token }} repository: ${{ github.repository }} run-id: ${{ github.event.workflow_run.id }} # defensive since issues could cause commenting in random places - name: Read PR number id: pr shell: bash run: | number="$(tr -cd '0-9' < ./pr/NR)" test -n "$number" echo "number=$number" >> "$GITHUB_OUTPUT" - name: Publish Touchstone plots if: ${{ steps.download_plots.outcome == 'success' }} uses: JamesIves/github-pages-deploy-action@v4.8.0 with: branch: touchstone-plots folder: plots target-folder: pr-${{ steps.pr.outputs.number }} commit-message: touchstone plots for PR #${{ steps.pr.outputs.number }} clean: false - name: Build comment body shell: bash env: PR_NUMBER: ${{ steps.pr.outputs.number }} run: | set -euo pipefail cp ./pr/info.txt ./comment.txt if ! compgen -G "./plots/*.png" > /dev/null; then exit 0 fi { printf '\n\n
\nPlots\n\n' for plot in ./plots/*.png; do file="$(basename "$plot")" label="${file%.png}" printf '![%s](../blob/touchstone-plots/pr-%s/%s?raw=true)\n\n' "$label" "$PR_NUMBER" "$file" done printf '
\n' } >> ./comment.txt - name: Create or update sticky PR comment id: comment uses: marocchino/sticky-pull-request-comment@v3 with: GITHUB_TOKEN: ${{ github.token }} number_force: ${{ steps.pr.outputs.number }} header: touchstone path: ./comment.txt