Unverified Commit 4faac45d authored by Daz DeBoer's avatar Daz DeBoer Committed by GitHub
Browse files

Merge pull request #1021 from gradle/dd/pr-comment

Automatically add Job Summary as PR comment
parents bc72ac9e 45ed6045
Loading
Loading
Loading
Loading
+2
Changes for .github/workflows/ci-full-check.yml: 2 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -31,6 +31,8 @@ jobs:

  dependency-graph:
    uses: ./.github/workflows/integ-test-dependency-graph.yml
    permissions:
      contents: write
    with:
      cache-key-prefix: ${{github.run_number}}-

+2
Changes for .github/workflows/ci-quick-check.yml: 2 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -53,6 +53,8 @@ jobs:
  dependency-graph:
    needs: build-distribution
    uses: ./.github/workflows/integ-test-dependency-graph.yml
    permissions:
      contents: write
    with:
      runner-os: '["ubuntu-latest"]'
      download-dist: true
+22 −1
Changes for .github/workflows/demo-job-summary.yml: 22 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -8,7 +8,7 @@ env:
  GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true

jobs:
  run-gradle-builds:
  many-gradle-builds:
    runs-on: ubuntu-latest
    steps:
    - name: Checkout sources
@@ -42,6 +42,27 @@ jobs:
      continue-on-error: true
      run: ./gradlew not-a-real-task

  successful-builds-with-no-summary:
    runs-on: ubuntu-latest
    steps:
    - name: Checkout sources
      uses: actions/checkout@v4
    - name: Build distribution
      shell: bash
      run: |
        npm install
        npm run build
    - name: Setup Gradle
      uses: ./
      with:
        add-job-summary: on-failure
    - name: Build kotlin-dsl project
      working-directory: .github/workflow-samples/kotlin-dsl
      run: ./gradlew assemble
    - name: Build kotlin-dsl project without Build Scan®
      working-directory: .github/workflow-samples/kotlin-dsl
      run: ./gradlew assemble check --no-scan

  pre-existing-gradle-home:
    runs-on: ubuntu-latest
    steps:
+35 −11
Changes for .github/workflows/demo-pr-build-scan-comment.yml: 35 added lines, 11 removed lines.
Original line number Diff line number Diff line
@@ -2,26 +2,50 @@ name: Demo adding Build Scan® comment to PR
on:
  pull_request:
    types: [assigned, review_requested]

permissions:
  pull-requests: write

jobs:
  gradle:
  successful-build-with-always-comment:
    runs-on: ubuntu-latest
    steps:
    - name: Checkout project sources
      uses: actions/checkout@v4
    - name: Setup Gradle
      uses: ./
      with:
        add-job-summary-as-pr-comment: always
    - name: Run build with Gradle wrapper
      id: gradle
      working-directory: .github/workflow-samples/kotlin-dsl
      run: ./gradlew build --scan
    - name: "Add Build Scan URL as PR comment"
      uses: actions/github-script@v7

  successful-build-with-comment-on-failure:
    runs-on: ubuntu-latest
    steps:
    - name: Checkout project sources
      uses: actions/checkout@v4
    - name: Setup Gradle
      uses: ./
      with:
        github-token: ${{secrets.GITHUB_TOKEN}}
        script: |
          github.rest.issues.createComment({
            issue_number: context.issue.number,
            owner: context.repo.owner,
            repo: context.repo.repo,
            body: 'PR ready for review: ${{ steps.gradle.outputs.build-scan-url }}'
          })
        add-job-summary-as-pr-comment: on-failure
    - name: Run build with Gradle wrapper
      id: gradle
      working-directory: .github/workflow-samples/kotlin-dsl
      run: ./gradlew build --scan

  failing-build-with-comment-on-failure:
    runs-on: ubuntu-latest
    steps:
    - name: Checkout project sources
      uses: actions/checkout@v4
    - name: Setup Gradle
      uses: ./
      with:
        add-job-summary-as-pr-comment: on-failure
    - name: Run build with Gradle wrapper
      id: gradle
      working-directory: .github/workflow-samples/kotlin-dsl
      run: ./gradlew no-a-real-task --scan
      continue-on-error: true
+3
Changes for .github/workflows/integ-test-dependency-graph.yml: 3 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -12,6 +12,9 @@ on:
        type: boolean
        default: false

permissions:
  contents: write

env:
  DOWNLOAD_DIST: ${{ inputs.download-dist }}
  GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: dependency-graph-${{ inputs.cache-key-prefix }}
Loading