Merge remote-tracking branch 'origin/main' #12
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Comment on Pull Request | ||
| on: | ||
| pull_request_target: | ||
| types: [opened, reopened, synchronize] | ||
| branches: | ||
| - '*' | ||
| paths-ignore: | ||
| - 'README' | ||
| - 'README.md' | ||
| - 'LICENSE' | ||
| - 'LICENSE.md' | ||
| concurrency: | ||
| group: '${{ github.workflow }}-${{ github.head_ref }}' | ||
| cancel-in-progress: false | ||
| permissions: | ||
| issues: write | ||
| pull-requests: write | ||
| jobs: | ||
| build-and-comment: | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| comment_id: ${{ steps.comment.outputs.comment-id }} | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v2 | ||
| with: | ||
| ref: refs/pull/${{ github.event.pull_request.number }}/merge | ||
| - name: Find comment | ||
| uses: peter-evans/find-comment@v2 | ||
| id: find-comment | ||
| with: | ||
| issue-number: ${{ github.event.pull_request.number }} | ||
| comment-author: 'github-actions[bot]' | ||
| body-includes: '<!-- workflow comment -->' | ||
| - name: Post/Update comment | ||
| uses: peter-evans/create-or-update-comment@v3 | ||
| id: comment | ||
| with: | ||
| issue-number: ${{ github.event.pull_request.number }} | ||
| comment-id: ${{ steps.find-comment.outputs.comment-id }} | ||
| edit-mode: replace | ||
| body-path: '.github/assets/build-pr.md' | ||
| - name: Set up JDK | ||
| uses: actions/setup-java@v3 | ||
| with: | ||
| distribution: 'temurin' | ||
| java-version: | | ||
| 8 | ||
| 16 | ||
| 17 | ||
| 21 | ||
| - name: Grant execute permissions for gradlew | ||
| run: chmod +x gradlew | ||
| - name: Build with Gradle | ||
| run: ./gradlew build --no-daemon | ||
| - name: Upload artifact | ||
| uses: actions/upload-artifact@v3 | ||
| with: | ||
| name: build | ||
| path: | | ||
| build/libs/*.jar | ||
| versions/*/build/libs/*.jar | ||
| if-no-files-found: error | ||
| - name: Render Markdown Template | ||
| id: render | ||
| uses: chuhlomin/[email protected] | ||
| env: | ||
| JOB_PATH: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ env.PREVIOUS_JOB_ID }}" | ||
| ARTIFACT_URL: "${{ github.server_url }}/${{ github.repository }}/suites/${{ env.SUITE_ID }}/artifacts/${{ env.ARTIFACT_ID }}" | ||
| ARTIFACT_EXPIRE_DATE: "${{ env.ARTIFACT_EXPIRE_DATE }}" | ||
| HEAD_SHA: "${{ env.HEAD_SHA }}" | ||
| with: | ||
| template: './.github/assets/build-pr-success.md' | ||
| vars: | | ||
| commit: ${{ env.HEAD_SHA }} | ||
| logs: ${{ env.JOB_PATH }} | ||
| download: ${{ env.ARTIFACT_URL }} | ||
| expire: ${{ env.ARTIFACT_EXPIRE_DATE }} | ||
| - name: Post/Update comment | ||
| uses: peter-evans/create-or-update-comment@v3 | ||
| id: comment | ||
| with: | ||
| issue-number: ${{ github.event.pull_request.number }} | ||
| comment-id: ${{ steps.find-comment.outputs.comment-id }} | ||
| edit-mode: replace | ||
| body: ${{ steps.template.outputs.result }} | ||
| comment-if-failed: | ||
| needs: [build-and-comment] | ||
| if: failure() | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v2 | ||
| with: | ||
| ref: refs/pull/${{ github.event.pull_request.number }}/merge | ||
| - name: Render Markdown template | ||
| id: render | ||
| uses: chuhlomin/render-template@b7365ae850d49de8fbbc9af02f333f0150bdcc59 | ||
| with: | ||
| template: './.github/assets/pr-comments/failed.md' | ||
| vars: | | ||
| commit: ${{ github.event.pull_request.head.sha }} | ||
| logs: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | ||
| - name: Update comment (Failure) | ||
| uses: peter-evans/create-or-update-comment@v3 | ||
| with: | ||
| issue-number: ${{ github.event.pull_request.number }} | ||
| comment-id: ${{ needs.build-and-comment.outputs.comment_id }} | ||
| edit-mode: replace | ||
| body: ${{ steps.render.outputs.result }} | ||