diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1cf8a9b83..84df33e44 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -108,7 +108,7 @@ jobs: name: target (${{ matrix.pretty }},${{ matrix.os }}) runs-on: ${{ matrix.os }} needs: [shellcheck, test, generate-matrix, check] - if: (github.event_name == 'push' || github.event_name == 'merge_group') && needs.generate-matrix.outputs.matrix != '{}' && needs.generate-matrix.outputs.matrix != '[]' && needs.generate-matrix.outputs.matrix != '' + if: (github.event_name == 'push' || github.event_name == 'merge_group' || github.event_name == 'workflow_call') && needs.generate-matrix.outputs.matrix != '{}' && needs.generate-matrix.outputs.matrix != '[]' && needs.generate-matrix.outputs.matrix != '' concurrency: group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.pretty }} cancel-in-progress: false diff --git a/.github/workflows/try.yml b/.github/workflows/try.yml index 186fe7c69..ff4c5233b 100644 --- a/.github/workflows/try.yml +++ b/.github/workflows/try.yml @@ -9,3 +9,17 @@ jobs: uses: ./.github/workflows/ci.yml with: matrix-args: try --comment "${{ github.event.comment.body }}" --pr ${{ github.event.issue.number }} + comment: + needs: try + if: always() && needs.try.result != 'skipped' + runs-on: ubuntu-latest + steps: + # comment on the PR with the result and links to the logs using gh cli + # Something like `### Try build: [{result}]({link_to_logs})` + # the url to the logs are on jobs[name="try"].url gathered with `gh run view ${{ github.run_id }} --json jobs` + - name: Comment on PR + run: | + PR_ID = ${{ github.event.issue.number }} + gh run view ${{ github.run_id }} --json jobs |\ + jq -r '"Diff for [comment]("+$comment+")\n\n- [Run](" + (.jobs[] | select(.name == "try / generate-matrix") | .url) + ")\n" + ([.jobs[] | select(.name | startswith("try / target")) | select(.name | contains("matrix.pretty") | not ) | "- [" + (.name | capture("\\((?[^,]+),.*") | .name) + "](" + .url + "?pr=" + $pr_id + "#step:7:45)"] | join("\n"))' --arg pr_id "$PR_ID" --arg comment "${{ github.event.comment.url }}"|\ + gh pr comment "$PR_ID" --body "$(< /dev/stdin)"