Categorygithub.com/paha/github-action-go
modulepackage
0.1.0
Repository: https://github.com/paha/github-action-go.git
Documentation: pkg.go.dev

# README

github-action-go

GitHub Action to identify a path of changed files on monorepos, with regex and depth validation.

Example use-case is execution path for Terraform monorepo. The GitHub action fetches changed files from the GitHub PR API, validates paths to determine what directory Terraform execution needs to happen.

  • Using a container for action delivery avoids spending time fetching repo, dependencies, and compiling. Recommended use is container delivery via: docker://paha/github-action-tf-path
  • PR id is taken from GITHUB_REF_NAME, if fails, pr_number input is taken.
  • The path is persisted as a Pull Request label tf_path: PATH for visibility.

Required action inputs:

Input nameDescriptionSuggested value
tokenGitHub token${{ github.token }}

Optional action inputs:

Input nameDescriptionExample valuedefault
includeOnly output paths that match the regexmyprojectNone
excludeExclude paths that match the regexmynotes^.
depthTerrafrom project path depth11
pr_numberGitHub PR id${{ github.event.number }}$GITHUB_REF_NAME

Note:

Example

on:
  pull_request:

jobs:
  terraform:
    name: Debug
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Repository
        uses: actions/checkout@v2

      - name: TF path action
        id: path
        uses: docker://paha/github-action-tf-path:v0.0.2
        with:
          token: ${{ github.token }}

      - name: my path
        run: echo ${{ steps.path.outputs.tf_path }}

References: