Skip to content

Commit

Permalink
fix build and make a comment
Browse files Browse the repository at this point in the history
  • Loading branch information
Emilgardis committed Dec 27, 2023
1 parent 4282f2f commit 67a891c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/try.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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>[^,]+),.*") | .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)"

0 comments on commit 67a891c

Please sign in to comment.