zgosalvez / github-actions-ensure-sha-pinned-actions

A Github Action to ensure that actions are pinned to full length commit SHAs
https://github.com/marketplace/actions/ensure-sha-pinned-actions
MIT License
37 stars 12 forks source link
actions github github-actions

GitHub Action — Ensure SHA Pinned Actions

CI

This GitHub Action (written in JavaScript) allows you to leverage GitHub Actions to ensure that GitHub Actions are pinned to full length commit SHAs. This does not fail for referenced actions in the same repository when using the ./path/to/dir syntax. For more information, see "using third-party actions."

Usage

Pre-requisites

Create a workflow .yml file in your .github/workflows directory. An example workflow is available below. For more information, reference the GitHub Help Documentation for Creating a workflow file.

Inputs

For more information on these inputs, see the Workflow syntax for GitHub Actions

Outputs

None. This action will throw an error if it finds any GitHub Action that is not pinned to a full length commit SHAs.

Note: Only the first error encountered will be reported.

Common workflow

Ideally, set this up as an initial job for your workflows. For example:

on: push

name: Continuous Integration

jobs:
  harden_security:
    name: Harden Security
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
      - name: Ensure SHA pinned actions
        uses: zgosalvez/github-actions-ensure-sha-pinned-actions@v2 # Replace this
        with:
          allowlist: |
            aws-actions/
            docker/login-action

Contributing

See the contributing guide for detailed instructions on how to get started with our project.

License

The scripts and documentation in this project are released under the MIT License