|
10 | 10 | - cron: "50 1 * * *" |
11 | 11 |
|
12 | 12 | permissions: |
| 13 | + # Required to upload SARIF file to CodeQL. See: https://github.com/github/codeql-action/issues/2117 |
| 14 | + actions: read |
| 15 | + # Require writing security events to upload SARIF file to security tab |
| 16 | + security-events: write |
| 17 | + # to fetch code (actions/checkout) |
13 | 18 | contents: read |
14 | 19 |
|
15 | 20 | jobs: |
16 | 21 | latest: |
17 | 22 | # Only run the scheduled job in hyperledger/fabric repository, not on personal forks |
18 | 23 | if: github.event_name != 'schedule' || (github.event_name == 'schedule' && github.repository == 'hyperledger/fabric') |
19 | | - runs-on: ${{ github.repository == 'hyperledger/fabric' && 'fabric-ubuntu-22.04' || 'ubuntu-22.04' }} |
20 | 24 | strategy: |
21 | 25 | fail-fast: false |
22 | 26 | matrix: |
23 | 27 | ref: |
24 | 28 | - main |
25 | 29 | - release-2.5 |
26 | | - steps: |
27 | | - - name: Checkout ${{ matrix.ref }} branch |
28 | | - uses: actions/checkout@v4 |
29 | | - with: |
30 | | - ref: ${{ matrix.ref }} |
31 | | - - name: Set up Go |
32 | | - uses: actions/setup-go@v5 |
33 | | - with: |
34 | | - go-version-file: go.mod |
35 | | - - name: Scan |
36 | | - run: go run github.com/google/osv-scanner/v2/cmd/osv-scanner@latest scan --lockfile=go.mod || (( $? > 1 && $? < 127 )) |
| 30 | + uses: "google/osv-scanner-action/.github/workflows/osv-scanner-reusable.yml@main" |
| 31 | + with: |
| 32 | + scan-args: |- |
| 33 | + --lockfile=./go.mod |
| 34 | + --lockfile=./tools/go.mod |
| 35 | + matrix-property: ${{ matrix.ref }}- |
| 36 | + ref: ${{ matrix.ref }} |
37 | 37 |
|
38 | | - release: |
| 38 | + get-latest-releases: |
39 | 39 | # Only run the scheduled job in hyperledger/fabric repository, not on personal forks |
40 | 40 | if: github.event_name != 'schedule' || (github.event_name == 'schedule' && github.repository == 'hyperledger/fabric') |
41 | 41 | runs-on: ${{ github.repository == 'hyperledger/fabric' && 'fabric-ubuntu-22.04' || 'ubuntu-22.04' }} |
42 | 42 | strategy: |
43 | 43 | fail-fast: false |
44 | 44 | matrix: |
45 | 45 | ref: |
46 | | - - main |
47 | | - - release-2.5 |
| 46 | + - branch: main |
| 47 | + name: main |
| 48 | + - branch: release-2.5 |
| 49 | + name: release_25 |
| 50 | + outputs: |
| 51 | + output_main: ${{ steps.latest_release.outputs.tag_main }} |
| 52 | + output_release-25: ${{ steps.latest_release.outputs.tag_release_25 }} |
48 | 53 | steps: |
49 | | - - name: Checkout ${{ matrix.ref }} branch |
| 54 | + - name: Checkout ${{ matrix.ref.branch }} branch |
50 | 55 | uses: actions/checkout@v4 |
51 | 56 | with: |
52 | | - ref: ${{ matrix.ref }} |
| 57 | + ref: ${{ matrix.ref.branch }} |
53 | 58 | fetch-depth: 0 |
54 | | - - name: Get latest release tag |
55 | | - id: latest-release |
56 | | - run: echo "tag=$(git -c versionsort.suffix=- tag --merged HEAD --sort=-version:refname | head -1)" >> "${GITHUB_OUTPUT}" |
57 | | - - name: Checkout ${{ steps.latest-release.outputs.tag }} |
58 | | - uses: actions/checkout@v4 |
59 | | - with: |
60 | | - ref: ${{ steps.latest-release.outputs.tag }} |
61 | | - - name: Set up Go |
62 | | - uses: actions/setup-go@v5 |
63 | | - with: |
64 | | - go-version-file: go.mod |
65 | | - - name: Scan |
66 | | - run: go run github.com/google/osv-scanner/v2/cmd/osv-scanner@latest scan --lockfile=go.mod || (( $? > 1 && $? < 127 )) |
| 59 | + - name: Get latest release |
| 60 | + id: latest_release |
| 61 | + run: | |
| 62 | + version="${{ matrix.ref.name }}" |
| 63 | + echo "tag_${version}=$(git -c versionsort.suffix=- tag --merged HEAD --sort=-version:refname | head -1)" >> "$GITHUB_OUTPUT" |
| 64 | +
|
| 65 | + release: |
| 66 | + needs: |
| 67 | + - get-latest-releases |
| 68 | + if: github.event_name != 'schedule' || (github.event_name == 'schedule' && github.repository == 'hyperledger/fabric') |
| 69 | + strategy: |
| 70 | + fail-fast: false |
| 71 | + matrix: |
| 72 | + ref: |
| 73 | + - branch: main |
| 74 | + tag: ${{ needs.get-latest-releases.outputs.output_main }} |
| 75 | + - branch: release-2.5 |
| 76 | + tag: ${{ needs.get-latest-releases.outputs.output_release-25 }} |
| 77 | + uses: "google/osv-scanner-action/.github/workflows/osv-scanner-reusable.yml@main" |
| 78 | + with: |
| 79 | + scan-args: |- |
| 80 | + --lockfile=./go.mod |
| 81 | + --lockfile=./tools/go.mod |
| 82 | + matrix-property: ${{ matrix.ref.tag }}- |
| 83 | + ref: ${{ matrix.ref.tag }} |
0 commit comments