digitalocean / gta

gta: do transitive analysis to find packages whose dependencies have changed
Apache License 2.0
202 stars 21 forks source link

How to use with Github Actions and `push` events #39

Closed fatmcgav closed 1 year ago

fatmcgav commented 1 year ago

Hey there,

I'm trying to use gta to detect changes in a Golang monorepo on push events in Github actions.

However I am getting the following error:

Run gta -include "$(go list -f '{{ .Module.Path }}')/"

15:13:38 main.go:82: can't list dirty packages: diffing directory for dirty packages, exit status 128
Error: Process completed with exit code 1.

The workflow currently looks like:

---
name: Services Release

on:
  push:
    branches:
      # - master
      - test-branch

jobs:
  detect-changes:
    name: Detect changed services
    runs-on: ubuntu-latest
    timeout-minutes: 5

    steps:
      - name: Checkout
        id: checkout
        uses: actions/checkout@v3
        with:
          depth: 0

      - name: Setup Go
        id: setup-go
        uses: actions/setup-go@v4
        with:
          go-version-file: 'go.mod'

      - name: Install gta
        id: install-gta
        env:
          GOFLAGS: ""
        run: go install github.com/digitalocean/gta/cmd/gta@latest

      - name: Run gta
        id: run-gta
        run: |
          gta -include "$(go list -f '{{ .Module.Path }}')/"

I've tried changing the checkout step such as removing the depth, or setting it to 2. However the error doesn't change.

If I run gta locally on the same branch, I get the expected changed list...

Any suggestions?

Thanks

fatmcgav commented 1 year ago

And as soon as I open an issue, I spot a warning on the job where i've typo'd the checkout action...

It should be fetch-depth, not depth. And in my use, it needs to be set to 0.

Maybe worth adding to the repo for anyone else who comes along? :bow: