8000 Document how to properly use `base-ref` · Issue #430 · actions/dependency-review-action · GitHub
[go: up one dir, main page]

Skip to content
Document how to properly use base-ref #430
@nedbat

Description

@nedbat

I wanted to run this action on pushes, so I needed to specify base-ref and head-ref. I wasn't sure how to do it, so I searched GitHub for uses. A few things there seemed not right, because they set the two refs to be the same, but they are a comparison, so don't they have to be different?

https://github.com/fixator10/Fixator10-Cogs/blob/b6fd04ab5490862be71f3e31a7c1aa70282eead2/.github/workflows/dependency-review.yml#LL21-L22C76

          base-ref: ${{ github.event.pull_request.base.ref || github.ref }}
          head-ref: ${{ github.event.pull_request.head.ref || github.ref }}

https://github.com/marinchuck/test3/blob/6c0eaa622f8e2236a5f4bec5c16d822457225017/.github/workflows/ci-pipeline.yml#L79-L80

                    base-ref: main
                    head-ref: main

Others had more elaborate settings, but often hard-coded the base ref:
https://github.com/Infineon/ek-based-onboarding-optiga-tpm/blob/b00aefa07591394210d39fe306d704b52a23c270/.github/workflows/main.yml#L24-L25

          head-ref: ${{ github.ref }}
          base-ref: ec53ee4956ff702efdf1f7a06c87fdfe821dff0f

I used this:

          base-ref: ${{ github.event.pull_request.base.ref || 'master' }}
          head-ref: ${{ github.event.pull_request.head.ref || github.ref }}

What is the right way to do this? An example in the README would help people a lot I think.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0