From 0e615f313a942d57b7d4d058c8fbebf295ed9c77 Mon Sep 17 00:00:00 2001 From: Moritz Date: Tue, 9 Jan 2024 15:50:30 +0100 Subject: [PATCH 01/12] Don't write the failure string when skipping --- .github/workflows/health_base.yaml | 17 ++++++++++++----- pkgs/firehose/CHANGELOG.md | 4 ++++ pkgs/firehose/lib/src/health/health.dart | 1 + pkgs/firehose/pubspec.yaml | 2 +- 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/.github/workflows/health_base.yaml b/.github/workflows/health_base.yaml index 8870ec0c..af4a1d40 100644 --- a/.github/workflows/health_base.yaml +++ b/.github/workflows/health_base.yaml @@ -71,10 +71,7 @@ jobs: path: base_repo/ if: ${{ inputs.check == 'coverage' }} || ${{ inputs.check == 'breaking' }} - - name: Write comment if not present - run: | - mkdir -p current_repo/output/ - test -f current_repo/output/comment.md || echo $'The ${{ inputs.check }} workflow has encountered an exception and did not complete.' >> current_repo/output/comment.md + - run: mkdir -p current_repo/output/ - uses: subosito/flutter-action@2783a3f08e1baf891508463f8c6653c258246225 if: ${{ inputs.use-flutter }} @@ -109,7 +106,17 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} ISSUE_NUMBER: ${{ github.event.number }} PR_LABELS: "${{ join(github.event.pull_request.labels.*.name) }}" - run: cd current_repo/ && dart pub global run firehose:health --check ${{ inputs.check }} ${{ fromJSON('{"true":"--coverage_web","false":""}')[inputs.coverage_web] }} --fail_on ${{ inputs.fail_on }} --warn_on ${{ inputs.warn_on }} + run: | + cd current_repo/ && \ + dart pub global run firehose:health \ + --check ${{ inputs.check }} \ + ${{ fromJSON('{"true":"--coverage_web","false":""}')[inputs.coverage_web] }} \ + --fail_on ${{ inputs.fail_on }} \ + --warn_on ${{ inputs.warn_on }} \ + echo "exitcode=$?" >> $GITHUB_ENV + + - run: test -f current_repo/output/comment.md || echo $'The ${{ inputs.check }} workflow has encountered an exception and did not complete.' >> current_repo/output/comment.md + if: ${{ '$action_state' != 4 }} - name: Upload coverage to Coveralls if: ${{ inputs.upload_coverage }} diff --git a/pkgs/firehose/CHANGELOG.md b/pkgs/firehose/CHANGELOG.md index 23613cda..35c13529 100644 --- a/pkgs/firehose/CHANGELOG.md +++ b/pkgs/firehose/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.5.1 + +- Set exit code for skipping workflow. + ## 0.5.0 - Split health checks in individual workflows. diff --git a/pkgs/firehose/lib/src/health/health.dart b/pkgs/firehose/lib/src/health/health.dart index 5dab5e4d..354bdcff 100644 --- a/pkgs/firehose/lib/src/health/health.dart +++ b/pkgs/firehose/lib/src/health/health.dart @@ -87,6 +87,7 @@ class Health { await writeInComment(github, finalResult); print('\n\n${finalResult.severity.name.toUpperCase()}: $check done.\n\n'); } else { + exitCode = 4; print('Skipping $check, as the skip tag is present.'); } } diff --git a/pkgs/firehose/pubspec.yaml b/pkgs/firehose/pubspec.yaml index 57e90f3f..6d657bb8 100644 --- a/pkgs/firehose/pubspec.yaml +++ b/pkgs/firehose/pubspec.yaml @@ -1,6 +1,6 @@ name: firehose description: A tool to automate publishing of Pub packages from GitHub actions. -version: 0.5.0 +version: 0.5.1 repository: https://github.com/dart-lang/ecosystem/tree/main/pkgs/firehose environment: From 7abe8329995d2ac42edd877d8e245705f2a1ce54 Mon Sep 17 00:00:00 2001 From: Moritz Date: Tue, 9 Jan 2024 16:07:28 +0100 Subject: [PATCH 02/12] Fix bash command --- .github/workflows/health_base.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/health_base.yaml b/.github/workflows/health_base.yaml index af4a1d40..eb52362c 100644 --- a/.github/workflows/health_base.yaml +++ b/.github/workflows/health_base.yaml @@ -107,12 +107,12 @@ jobs: ISSUE_NUMBER: ${{ github.event.number }} PR_LABELS: "${{ join(github.event.pull_request.labels.*.name) }}" run: | - cd current_repo/ && \ + cd current_repo/ dart pub global run firehose:health \ --check ${{ inputs.check }} \ ${{ fromJSON('{"true":"--coverage_web","false":""}')[inputs.coverage_web] }} \ --fail_on ${{ inputs.fail_on }} \ - --warn_on ${{ inputs.warn_on }} \ + --warn_on ${{ inputs.warn_on }} echo "exitcode=$?" >> $GITHUB_ENV - run: test -f current_repo/output/comment.md || echo $'The ${{ inputs.check }} workflow has encountered an exception and did not complete.' >> current_repo/output/comment.md From 9118afcaa3580e60d40a48c187a99b25dadcf35b Mon Sep 17 00:00:00 2001 From: Moritz Date: Tue, 9 Jan 2024 16:14:40 +0100 Subject: [PATCH 03/12] Don't exit with 4 --- .github/workflows/health_base.yaml | 3 +-- pkgs/firehose/lib/src/health/health.dart | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/health_base.yaml b/.github/workflows/health_base.yaml index eb52362c..dd38f7bc 100644 --- a/.github/workflows/health_base.yaml +++ b/.github/workflows/health_base.yaml @@ -113,10 +113,9 @@ jobs: ${{ fromJSON('{"true":"--coverage_web","false":""}')[inputs.coverage_web] }} \ --fail_on ${{ inputs.fail_on }} \ --warn_on ${{ inputs.warn_on }} - echo "exitcode=$?" >> $GITHUB_ENV - run: test -f current_repo/output/comment.md || echo $'The ${{ inputs.check }} workflow has encountered an exception and did not complete.' >> current_repo/output/comment.md - if: ${{ '$action_state' != 4 }} + if: ${{ '$action_state' == 1 }} - name: Upload coverage to Coveralls if: ${{ inputs.upload_coverage }} diff --git a/pkgs/firehose/lib/src/health/health.dart b/pkgs/firehose/lib/src/health/health.dart index 354bdcff..5dab5e4d 100644 --- a/pkgs/firehose/lib/src/health/health.dart +++ b/pkgs/firehose/lib/src/health/health.dart @@ -87,7 +87,6 @@ class Health { await writeInComment(github, finalResult); print('\n\n${finalResult.severity.name.toUpperCase()}: $check done.\n\n'); } else { - exitCode = 4; print('Skipping $check, as the skip tag is present.'); } } From d5ec3506b3a8485af8a0d71f98edf2bbf10cd5e7 Mon Sep 17 00:00:00 2001 From: Moritz Date: Tue, 9 Jan 2024 16:17:14 +0100 Subject: [PATCH 04/12] Test not checking for changelog --- .github/workflows/health_internal.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/health_internal.yaml b/.github/workflows/health_internal.yaml index a6339335..fe24c22a 100644 --- a/.github/workflows/health_internal.yaml +++ b/.github/workflows/health_internal.yaml @@ -12,6 +12,6 @@ jobs: local_debug: true coverage_web: false upload_coverage: false - checks: version,changelog,license,coverage,breaking,do-not-submit + checks: version,license,coverage,breaking,do-not-submit fail_on: version,changelog,do-not-submit warn_on: license,coverage,breaking From c9836e0a8289c6a83c0559b2aea180762d956b72 Mon Sep 17 00:00:00 2001 From: Moritz Date: Tue, 9 Jan 2024 16:24:04 +0100 Subject: [PATCH 05/12] Test removing changelog from health defaults --- .github/workflows/health.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/health.yaml b/.github/workflows/health.yaml index d2cf26e1..87857713 100644 --- a/.github/workflows/health.yaml +++ b/.github/workflows/health.yaml @@ -49,7 +49,7 @@ on: # needed. checks: description: What to check for in the PR health check - any subset of "version,changelog,license,coverage,breaking,do-not-submit" - default: "version,changelog,license,coverage,breaking,do-not-submit" + default: "version,license,coverage,breaking,do-not-submit" type: string required: false fail_on: From fbcb375803ff2b89094969295f2b35dd8818eade Mon Sep 17 00:00:00 2001 From: Moritz Date: Tue, 9 Jan 2024 16:27:42 +0100 Subject: [PATCH 06/12] Add debug steps --- .github/workflows/health.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/health.yaml b/.github/workflows/health.yaml index 87857713..bfcbe38a 100644 --- a/.github/workflows/health.yaml +++ b/.github/workflows/health.yaml @@ -85,6 +85,13 @@ on: type: boolean jobs: + debug: + runs-on: ubuntu-latest + steps: + + - name: contains(${{ inputs.checks }}, 'changelog') + run: echo ${{ inputs.checks }} + version: if: contains(${{ inputs.checks }}, 'version') uses: ./.github/workflows/health_base.yaml From 292ef710c0f9c8fb65114ae8ec4266257e6adeac Mon Sep 17 00:00:00 2001 From: Moritz Date: Tue, 9 Jan 2024 17:58:45 +0100 Subject: [PATCH 07/12] Switch changelog if clause syntax --- .github/workflows/health.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/health.yaml b/.github/workflows/health.yaml index bfcbe38a..d7e4a516 100644 --- a/.github/workflows/health.yaml +++ b/.github/workflows/health.yaml @@ -104,7 +104,7 @@ jobs: use-flutter: ${{ inputs.use-flutter }} changelog: - if: contains(${{ inputs.checks }}, 'changelog') + if: ${{ contains(inputs.checks, 'changelog') }} uses: ./.github/workflows/health_base.yaml with: sdk: ${{ inputs.sdk }} From e2b694aab0e3e0e415c22111721b029eb6e9ba95 Mon Sep 17 00:00:00 2001 From: Moritz Date: Tue, 9 Jan 2024 18:02:01 +0100 Subject: [PATCH 08/12] Fix all --- .github/workflows/health.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/health.yaml b/.github/workflows/health.yaml index d7e4a516..01c13572 100644 --- a/.github/workflows/health.yaml +++ b/.github/workflows/health.yaml @@ -89,11 +89,11 @@ jobs: runs-on: ubuntu-latest steps: - - name: contains(${{ inputs.checks }}, 'changelog') + - name: ${{ contains(inputs.checks, 'changelog') }} run: echo ${{ inputs.checks }} version: - if: contains(${{ inputs.checks }}, 'version') + if: ${{ contains(inputs.checks, 'version') }} uses: ./.github/workflows/health_base.yaml with: sdk: ${{ inputs.sdk }} @@ -115,7 +115,7 @@ jobs: use-flutter: ${{ inputs.use-flutter }} license: - if: contains(${{ inputs.checks }}, 'license') + if: ${{ contains(inputs.checks, 'license') }} uses: ./.github/workflows/health_base.yaml with: sdk: ${{ inputs.sdk }} @@ -126,7 +126,7 @@ jobs: use-flutter: ${{ inputs.use-flutter }} coverage: - if: contains(${{ inputs.checks }}, 'coverage') + if: ${{ contains(inputs.checks, 'coverage') }} uses: ./.github/workflows/health_base.yaml with: sdk: ${{ inputs.sdk }} @@ -139,7 +139,7 @@ jobs: use-flutter: ${{ inputs.use-flutter }} breaking: - if: contains(${{ inputs.checks }}, 'breaking') + if: ${{ contains(inputs.checks, 'breaking') }} uses: ./.github/workflows/health_base.yaml with: sdk: ${{ inputs.sdk }} @@ -150,7 +150,7 @@ jobs: use-flutter: ${{ inputs.use-flutter }} do-not-submit: - if: contains(${{ inputs.checks }}, 'do-not-submit') + if: ${{ contains(inputs.checks, 'do-not-submit') }} uses: ./.github/workflows/health_base.yaml with: sdk: ${{ inputs.sdk }} From b85be5842542da9305055de30c553d603a9dc17e Mon Sep 17 00:00:00 2001 From: Moritz Date: Tue, 9 Jan 2024 18:02:42 +0100 Subject: [PATCH 09/12] Revert debug changes --- .github/workflows/health.yaml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/health.yaml b/.github/workflows/health.yaml index 01c13572..4c1d2d2b 100644 --- a/.github/workflows/health.yaml +++ b/.github/workflows/health.yaml @@ -85,13 +85,6 @@ on: type: boolean jobs: - debug: - runs-on: ubuntu-latest - steps: - - - name: ${{ contains(inputs.checks, 'changelog') }} - run: echo ${{ inputs.checks }} - version: if: ${{ contains(inputs.checks, 'version') }} uses: ./.github/workflows/health_base.yaml From a888b5d031dce87f8a44f3fc46d22c6ff1ebbecd Mon Sep 17 00:00:00 2001 From: Moritz Date: Tue, 9 Jan 2024 18:03:13 +0100 Subject: [PATCH 10/12] Revert "Test removing changelog from health defaults" This reverts commit c9836e0a8289c6a83c0559b2aea180762d956b72. --- .github/workflows/health.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/health.yaml b/.github/workflows/health.yaml index 4c1d2d2b..831b5a49 100644 --- a/.github/workflows/health.yaml +++ b/.github/workflows/health.yaml @@ -49,7 +49,7 @@ on: # needed. checks: description: What to check for in the PR health check - any subset of "version,changelog,license,coverage,breaking,do-not-submit" - default: "version,license,coverage,breaking,do-not-submit" + default: "version,changelog,license,coverage,breaking,do-not-submit" type: string required: false fail_on: From a32cd0370a2c1dde3caa123e7e72983572353423 Mon Sep 17 00:00:00 2001 From: Moritz Date: Tue, 9 Jan 2024 18:16:04 +0100 Subject: [PATCH 11/12] Remove changelog --- pkgs/firehose/CHANGELOG.md | 4 ---- pkgs/firehose/pubspec.yaml | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/pkgs/firehose/CHANGELOG.md b/pkgs/firehose/CHANGELOG.md index 35c13529..23613cda 100644 --- a/pkgs/firehose/CHANGELOG.md +++ b/pkgs/firehose/CHANGELOG.md @@ -1,7 +1,3 @@ -## 0.5.1 - -- Set exit code for skipping workflow. - ## 0.5.0 - Split health checks in individual workflows. diff --git a/pkgs/firehose/pubspec.yaml b/pkgs/firehose/pubspec.yaml index 6d657bb8..57e90f3f 100644 --- a/pkgs/firehose/pubspec.yaml +++ b/pkgs/firehose/pubspec.yaml @@ -1,6 +1,6 @@ name: firehose description: A tool to automate publishing of Pub packages from GitHub actions. -version: 0.5.1 +version: 0.5.0 repository: https://github.com/dart-lang/ecosystem/tree/main/pkgs/firehose environment: From 6e5a3ec35add8ef836435fcdaf1b33d6dfadddff Mon Sep 17 00:00:00 2001 From: Moritz Date: Tue, 9 Jan 2024 18:17:13 +0100 Subject: [PATCH 12/12] Remove debug change --- .github/workflows/health_internal.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/health_internal.yaml b/.github/workflows/health_internal.yaml index fe24c22a..a6339335 100644 --- a/.github/workflows/health_internal.yaml +++ b/.github/workflows/health_internal.yaml @@ -12,6 +12,6 @@ jobs: local_debug: true coverage_web: false upload_coverage: false - checks: version,license,coverage,breaking,do-not-submit + checks: version,changelog,license,coverage,breaking,do-not-submit fail_on: version,changelog,do-not-submit warn_on: license,coverage,breaking