Update garethahealy/pre-commit-action action to v4.6.0 #1976
Workflow file for this run
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, Analyze and Test" | |
| on: [ push, pull_request ] | |
| # Declare default permissions as read only. | |
| permissions: read-all | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| packages: write | |
| steps: | |
| - name: Harden Runner | |
| uses: step-security/harden-runner@a5ad31d6a139d249332a2605b85202e8c0b78450 # v2.19.1 | |
| with: | |
| egress-policy: audit | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0 | |
| with: | |
| distribution: "temurin" | |
| java-version: 25 | |
| cache: "maven" | |
| - name: Dependency Review | |
| if: github.event_name == 'pull_request' | |
| uses: actions/dependency-review-action@2031cfc080254a8a887f58cffee85186f0e49e48 # v4.9.0 | |
| - name: Collect dependencies | |
| run: | | |
| ./mvnw dependency:go-offline dependency:resolve dependency:resolve-sources dependency:resolve-plugins -Dclassifier=javadoc --batch-mode | |
| ./mvnw verify -DskipTests --fail-never --batch-mode | |
| - name: Build | |
| env: | |
| GITHUB_LOGIN: ${{ secrets.COP_GITHUB_LOGIN }} | |
| GITHUB_OAUTH: ${{ secrets.COP_GITHUB_OAUTH }} | |
| run: ./mvnw clean install -Pnative -DskipTests --batch-mode | |
| - name: Test | |
| env: | |
| GITHUB_LOGIN: ${{ secrets.COP_GITHUB_LOGIN }} | |
| GITHUB_OAUTH: ${{ secrets.COP_GITHUB_OAUTH }} | |
| run: ./mvnw test -DskipITs=true --batch-mode | |
| - name: Run help command | |
| id: runner | |
| env: | |
| GITHUB_LOGIN: ${{ secrets.COP_GITHUB_LOGIN }} | |
| GITHUB_OAUTH: ${{ secrets.COP_GITHUB_OAUTH }} | |
| run: | | |
| runners=(target/github-stats-*-runner) | |
| echo "cmd=$(basename ${runners[0]})" >> "$GITHUB_OUTPUT" | |
| "${runners[0]}" help | |
| - name: Upload target | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: target | |
| path: target/ | |
| if-no-files-found: error | |
| - name: Upload runner binary | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: runner | |
| path: target/github-stats-*-runner | |
| if-no-files-found: error | |
| - name: Generate hashes | |
| shell: bash | |
| id: hash | |
| run: | | |
| echo "hashes=$(sha256sum target/github-stats-*-runner | base64 -w0)" >> "$GITHUB_OUTPUT" | |
| outputs: | |
| hashes: ${{ steps.hash.outputs.hashes }} | |
| runner: "${{ steps.runner.outputs.cmd }}" | |
| analyze: | |
| needs: [ build ] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| security-events: write | |
| contents: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0 | |
| with: | |
| distribution: "temurin" | |
| java-version: 25 | |
| - name: Initialize CodeQL | |
| uses: github/codeql-action/init@68bde559dea0fdcac2102bfdf6230c5f70eb485e # v4.35.4 | |
| with: | |
| languages: java | |
| - name: Autobuild | |
| uses: github/codeql-action/autobuild@68bde559dea0fdcac2102bfdf6230c5f70eb485e # v4.35.4 | |
| - name: Perform CodeQL Analysis | |
| uses: github/codeql-action/analyze@68bde559dea0fdcac2102bfdf6230c5f70eb485e # v4.35.4 | |
| with: | |
| category: "/language:java" | |
| - name: Submit Dependency Snapshot | |
| uses: advanced-security/maven-dependency-submission-action@b275d12641ac2d2108b2cbb7598b154ad2f2cee8 # v5 | |
| test: | |
| needs: [ build ] | |
| runs-on: ubuntu-latest | |
| env: | |
| RUNNER: "${{ needs.build.outputs.runner }}" | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Download target | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8 | |
| with: | |
| name: target | |
| - name: Make github-stats-*-runner executable | |
| run: chmod +x ${{ env.RUNNER }} | |
| - name: Run 'collect-stats' for CoP | |
| env: | |
| GITHUB_LOGIN: ${{ secrets.COP_GITHUB_LOGIN }} | |
| GITHUB_OAUTH: ${{ secrets.COP_GITHUB_OAUTH }} | |
| run: ./${{ env.RUNNER }} collect-stats --organization=redhat-cop --csv-output=/tmp/redhat-cop-collect-stats.csv --repository-limit=5 | |
| - name: Upload /tmp/*.csv | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: outputs.csv | |
| path: /tmp/*.csv | |
| if-no-files-found: error | |
| provenance_binary: | |
| needs: [ build ] | |
| if: startsWith(github.ref, 'refs/tags/') | |
| permissions: | |
| actions: read | |
| id-token: write | |
| contents: write | |
| uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v2.1.0 | |
| with: | |
| base64-subjects: "${{ needs.build.outputs.hashes }}" | |
| upload-assets: true | |
| release: | |
| needs: [ build ] | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/') | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Download runner | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8 | |
| with: | |
| name: runner | |
| - name: Upload assets to release | |
| uses: softprops/action-gh-release@b4309332981a82ec1c5618f44dd2e27cc8bfbfda # v3 | |
| with: | |
| files: | | |
| github-stats-*-runner |