Foundation-Security/Black Duck Scan #4
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
| --- | |
| ### | |
| # Foundation-security BlackDuck workflow | |
| # version: 2.4 | |
| ### | |
| name: Foundation-Security/Black Duck Scan | |
| on: | |
| push: | |
| tags: | |
| - "**" | |
| pull_request: | |
| types: [opened, synchronize, reopened] | |
| branches: | |
| - "**" | |
| schedule: | |
| - cron: "0 3 * * *" # 3:00 AM UTC / 10PM EST | |
| workflow_dispatch: | |
| inputs: | |
| scan-mode: | |
| description: "Black Duck Scan mode" | |
| required: true | |
| type: choice | |
| options: | |
| - RAPID | |
| - INTELLIGENT | |
| default: RAPID | |
| ref: | |
| description: "Branch to scan" | |
| required: true | |
| default: "main" | |
| jobs: | |
| Blackduck-Scan: | |
| name: BlackDuck Scan Job | |
| if: ${{ github.actor != 'dependabot[bot]' }} | |
| permissions: | |
| id-token: write | |
| contents: read | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - name: Create GitHub App token | |
| uses: EnterpriseDB/upm-github-actions/create-gh-app-token@main | |
| with: | |
| GH_APP_ID: ${{ secrets.FOUNDATION_SECURITY_APP_ID }} | |
| GH_APP_PRIVATE_KEY: ${{ secrets.FOUNDATION_SECURITY_APP_PRIVATE_KEY }} | |
| - name: Checkout source repository for dispatch runs | |
| id: checkout-source-dispatch | |
| if: github.event_name == 'workflow_dispatch' | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: ${{ github.repository }} | |
| ref: ${{ inputs.ref }} | |
| path: source | |
| token: ${{ env.GH_APP_TOKEN }} | |
| - name: Set project name and version for dispatch runs | |
| id: set-project-name-and-version-dispatch | |
| if: github.event_name == 'workflow_dispatch' | |
| run: | | |
| echo "PROJECT_NAME=${{ github.event.repository.name }}" >> "$GITHUB_ENV" | |
| echo "PROJECT_VERSION=${{ inputs.ref }}" >> "$GITHUB_ENV" | |
| - name: Checkout source repository for non-dispatch runs | |
| id: checkout-source | |
| if: github.event_name != 'workflow_dispatch' | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: ${{ github.repository }} | |
| ref: ${{ github.ref }} | |
| path: source | |
| token: ${{ env.GH_APP_TOKEN }} | |
| - name: Set project name and version for non-dispatch runs | |
| id: set-project-name-and-version | |
| if: github.event_name != 'workflow_dispatch' | |
| run: | | |
| echo "PROJECT_NAME=${{ github.event.repository.name }}" >> "$GITHUB_ENV" | |
| echo "PROJECT_VERSION=${{ github.ref_name }}" >> "$GITHUB_ENV" | |
| - name: Get short hash | |
| shell: bash | |
| if: ${{ inputs.scan-mode == 'INTELLIGENT' }} | |
| run: | | |
| cd source | |
| echo "sha_short=$(git rev-parse --short "$GITHUB_SHA")" >> "$GITHUB_ENV" | |
| - name: Checkout foundation-security repository | |
| id: checkout-foundation-security | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: EnterpriseDB/foundation-security | |
| ref: stable | |
| lfs: true | |
| path: foundation-security | |
| token: ${{ env.GH_APP_TOKEN }} | |
| - name: BlackDuck Scan | |
| id: call-bd-action | |
| uses: ./foundation-security/actions/blackduck | |
| with: | |
| github-token: ${{ env.GH_APP_TOKEN }} | |
| commit-hash: ${{ env.sha_short }} | |
| git-tag: ${{ github.tag }} | |
| blackduck-url: ${{ vars.BD_URL }} | |
| blackduck-api-token: ${{ secrets.BLACKDUCK_API_TOKEN }} | |
| project-name: ${{ env.PROJECT_NAME }} | |
| project-version: ${{ env.PROJECT_VERSION }} |