Skip to content

Can it work with normal push instead of just pull request? #826

Open
@umeshnebhani733

Description

@umeshnebhani733

We are not using a pull requests, we tried using it for normal push as follows, however it seems to be not working as we want it to be.

Here is our usecase:

  • We want to ensure no one is pushing a code with lib having a licence outside of allowed list of license. If that happens pipeline should fail
  • We have collected a list of allowed license approved from a legal department & want to enforce it for all push happening on any pipeline in future.

Here is how my pipeline looks like
`name: Dependency Review

on:
push:
branches:
- main
paths-ignore:
- '.talismanrc'
pull_request:
branches:
- main

permissions:
contents: write

jobs:
dependency-review:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4

  - name: Set up JDK 17
    uses: actions/setup-java@v2
    with:
      distribution: 'adopt'
      java-version: '17'

  - name: Dependency Review
    uses: actions/dependency-review-action@v4
    with:
      config-file: './.github/dependency-review-config.yml'
      base-ref: ${{ github.event.pull_request.base.sha || github.event.before || github.sha }}
      head-ref: ${{ github.event.pull_request.head.sha || github.sha }}

  - name: Show Review Results
    run: |
      echo "Licenses Denied: ${{ steps.dependency-review.outputs.licenses_denied }}"
      echo "Vulnerabilities: ${{ steps.dependency-review.outputs.vulnerabilities }}"

  - name: 'Report'
    if: ${{ failure() }}
    run: |
      echo "Review failed. Licenses Denied: ${{ steps.dependency-review.outputs.licenses_denied }}"
      echo "Vulnerabilities: ${{ steps.dependency-review.outputs.vulnerabilities }}"`

2 problems i am facing:

  1. scan the existing licences n highlight if there are any licences not part of allowed list
  2. even for new code change its not working as we expect for normal push

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions