diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1cf8a9b83..a8e29aa3a 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 == 'issue_comment') && 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 @@ -316,7 +316,7 @@ jobs: name: podman runs-on: ubuntu-latest needs: [shellcheck, test, check] - if: github.event_name == 'push' + if: github.event_name == 'push' || github.event_name == 'issue_comment' strategy: fail-fast: false outputs: diff --git a/.github/workflows/try.yml b/.github/workflows/try.yml index 186fe7c69..d36166af8 100644 --- a/.github/workflows/try.yml +++ b/.github/workflows/try.yml @@ -5,7 +5,24 @@ on: jobs: try: - if: github.event.issue.pull_request && github.event.comment.author_association == 'MEMBER' && (contains(github.event.comment.body, '\n/ci try') || startsWith(github.event.comment.body, '/ci try')) + if: github.event.issue.pull_request && (github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER') && (contains(github.event.comment.body, '\n/ci try') || startsWith(github.event.comment.body, '/ci try')) 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: + - uses: actions/checkout@v3 + # 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)" + env: + GH_TOKEN: ${{ github.token }} diff --git a/.github/workflows/weekly.yml b/.github/workflows/weekly.yml index 8bf2a7dbb..c54f168b2 100644 --- a/.github/workflows/weekly.yml +++ b/.github/workflows/weekly.yml @@ -15,7 +15,7 @@ env: jobs: weekly: - uses: ./.github/workflows/CI.yml + uses: ./.github/workflows/ci.yml with: matrix-args: --weekly wiki: