[前][次][番号順一覧][スレッド一覧]

ruby-changes:74268

From: Takashi <ko1@a...>
Date: Thu, 27 Oct 2022 05:54:17 +0900 (JST)
Subject: [ruby-changes:74268] a8e2d73628 (master): Fix the url of Cirrus failure notifications [ci skip]

https://git.ruby-lang.org/ruby.git/commit/?id=a8e2d73628

From a8e2d73628fd859dd6d33d989e4a0ee22a0c74df Mon Sep 17 00:00:00 2001
From: Takashi Kokubun <takashikkbn@g...>
Date: Wed, 26 Oct 2022 13:52:07 -0700
Subject: Fix the url of Cirrus failure notifications [ci skip]

The previous one was the url of this notification action, but we want to
see a link to Cirrus CI.

This code follows https://cirrus-ci.org/guide/notifications/.

Also, head_branch was null only for pull requests from a fork, so we can
use it for branch-based filtering, which is good.
---
 .github/workflows/cirrus-notify.yml | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/.github/workflows/cirrus-notify.yml b/.github/workflows/cirrus-notify.yml
index bbc84bf93b..fff717f1d6 100644
--- a/.github/workflows/cirrus-notify.yml
+++ b/.github/workflows/cirrus-notify.yml
@@ -10,23 +10,33 @@ jobs: https://github.com/ruby/ruby/blob/trunk/.github/workflows/cirrus-notify.yml#L10
       && github.event.check_suite.conclusion != 'success'
       && github.event.check_suite.conclusion != 'cancelled'
       && github.event.check_suite.conclusion != 'skipped'
+      && github.event.check_suite.head_branch == 'master'
     runs-on: ubuntu-latest
     steps:
+      - uses: octokit/request-action@v...
+        id: get_failed_check_run
+        with:
+          route: GET /repos/${{ github.repository }}/check-suites/${{ github.event.check_suite.id }}/check-runs?status=completed
+          mediaType: '{"previews": ["antiope"]}'
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
       - name: Dump GitHub context
         env:
           GITHUB_CONTEXT: ${{ toJson(github) }}
         run: echo "$GITHUB_CONTEXT"
+      - name: Dump check_runs
+        env:
+          CHECK_RUNS: ${{ steps.get_failed_check_run.outputs.data }}
+        run: echo "$CHECK_RUNS"
       - uses: ruby/action-slack@v...
         with:
           payload: |
             {
               "ci": "Cirrus CI",
               "env": "Cirrus CI",
-              "url": "https://github.com/ruby/ruby/actions/runs/${{ github.run_id }}",
+              "url": "${{ fromJson(steps.get_failed_check_run.outputs.data).check_runs[0].html_url }}",
               "commit": "${{ github.event.check_suite.head_commit.id }}",
               "branch": "${{ github.event.check_suite.head_branch }}"
             }
         env:
           SLACK_WEBHOOK_URL: ${{ secrets.SIMPLER_ALERTS_URL }} # ruby-lang slack: ruby/simpler-alerts-bot
-        # head_branch can be null. checking it here to see GITHUB_CONTEXT on master.
-        if: ${{ github.event.check_suite.head_branch == 'master' }}
-- 
cgit v1.2.3


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]