chia7712 commented on code in PR #17140:
URL: https://github.com/apache/kafka/pull/17140#discussion_r1750640368


##########
.github/workflows/ci-complete.yml:
##########
@@ -44,11 +60,48 @@ jobs:
         with:
           java-version: ${{ matrix.java }}
           develocity-access-key: ${{ secrets.GE_ACCESS_TOKEN }}
-      - uses: actions/download-artifact@v4
+      - name: Download build scan archive
+        id: download-build-scan
+        uses: actions/download-artifact@v4
+        continue-on-error: true
         with:
           github-token: ${{ github.token }}
           run-id: ${{ github.event.workflow_run.id }}
           name: build-scan-test-${{ matrix.java }}
-          path: ~/.gradle/build-scan-data
-      - name: Publish scan
-        run: ./gradlew --info buildScanPublishPrevious
+          path: ~/.gradle/build-scan-data  # This is where Gradle buffers 
unpublished build scan data when --no-scan is given
+      - name: Handle missing scan
+        if: ${{ steps.download-build-scan.outcome == 'failure' }}
+        run: |
+          echo "Could not download build scans from ${{ 
github.event.workflow_run.html_url }} " >> $GITHUB_STEP_SUMMARY
+      - name: Publish Scan
+        id: publish-build-scan
+        continue-on-error: true
+        if: ${{ steps.download-build-scan.outcome == 'success' }}
+        run: |
+          ./gradlew --info buildScanPublishPrevious > gradle.out
+          SCAN_URL=$(grep '^https://.*$' gradle.out)
+          cat gradle.out
+          echo "Published build scan to $SCAN_URL"

Review Comment:
   Maybe we can add it to `GITHUB_STEP_SUMMARY`?



##########
.github/workflows/ci-complete.yml:
##########
@@ -44,11 +60,48 @@ jobs:
         with:
           java-version: ${{ matrix.java }}
           develocity-access-key: ${{ secrets.GE_ACCESS_TOKEN }}
-      - uses: actions/download-artifact@v4
+      - name: Download build scan archive
+        id: download-build-scan
+        uses: actions/download-artifact@v4
+        continue-on-error: true
         with:
           github-token: ${{ github.token }}
           run-id: ${{ github.event.workflow_run.id }}
           name: build-scan-test-${{ matrix.java }}
-          path: ~/.gradle/build-scan-data
-      - name: Publish scan
-        run: ./gradlew --info buildScanPublishPrevious
+          path: ~/.gradle/build-scan-data  # This is where Gradle buffers 
unpublished build scan data when --no-scan is given
+      - name: Handle missing scan
+        if: ${{ steps.download-build-scan.outcome == 'failure' }}
+        run: |
+          echo "Could not download build scans from ${{ 
github.event.workflow_run.html_url }} " >> $GITHUB_STEP_SUMMARY
+      - name: Publish Scan
+        id: publish-build-scan
+        continue-on-error: true
+        if: ${{ steps.download-build-scan.outcome == 'success' }}
+        run: |
+          ./gradlew --info buildScanPublishPrevious > gradle.out
+          SCAN_URL=$(grep '^https://.*$' gradle.out)
+          cat gradle.out

Review Comment:
   this is for debugging, right?



##########
.github/workflows/ci-complete.yml:
##########
@@ -44,11 +60,48 @@ jobs:
         with:
           java-version: ${{ matrix.java }}
           develocity-access-key: ${{ secrets.GE_ACCESS_TOKEN }}
-      - uses: actions/download-artifact@v4
+      - name: Download build scan archive
+        id: download-build-scan
+        uses: actions/download-artifact@v4
+        continue-on-error: true
         with:
           github-token: ${{ github.token }}
           run-id: ${{ github.event.workflow_run.id }}
           name: build-scan-test-${{ matrix.java }}
-          path: ~/.gradle/build-scan-data
-      - name: Publish scan
-        run: ./gradlew --info buildScanPublishPrevious
+          path: ~/.gradle/build-scan-data  # This is where Gradle buffers 
unpublished build scan data when --no-scan is given
+      - name: Handle missing scan
+        if: ${{ steps.download-build-scan.outcome == 'failure' }}
+        run: |
+          echo "Could not download build scans from ${{ 
github.event.workflow_run.html_url }} " >> $GITHUB_STEP_SUMMARY
+      - name: Publish Scan
+        id: publish-build-scan
+        continue-on-error: true
+        if: ${{ steps.download-build-scan.outcome == 'success' }}
+        run: |
+          ./gradlew --info buildScanPublishPrevious > gradle.out
+          SCAN_URL=$(grep '^https://.*$' gradle.out)
+          cat gradle.out
+          echo "Published build scan to $SCAN_URL"
+          echo "build-scan-url=$SCAN_URL" >> $GITHUB_OUTPUT
+      - name: Handle failed publish
+        if: ${{ steps.publish-build-scan.outcome == 'failure' }}
+        uses: ./.github/actions/gh-api-update-status
+        with:
+          gh-token: ${{ secrets.GITHUB_TOKEN }}
+          repository: ${{ github.event.workflow_run.head_repository.full_name 
}}
+          commit_sha: ${{ github.event.workflow_run.head_sha }}
+          url: '${{ github.event.repository.html_url }}/actions/runs/${{ 
github.run_id }}'

Review Comment:
   It seems only two fields (`url` and `description`) are different. the value 
of `state` can be replaced by `steps.publish-build-scan.outcome`. Hence, do we 
still need extra `action.yml` file to set status? or we can call github APIs by 
script here?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to