diff --git a/.github/workflows/check-codeowners.yaml b/.github/workflows/check-codeowners.yaml index e80bb637062e7..6a5c0c6e030c8 100644 --- a/.github/workflows/check-codeowners.yaml +++ b/.github/workflows/check-codeowners.yaml @@ -21,43 +21,34 @@ concurrency: cancel-in-progress: true jobs: - setup-environment: - timeout-minutes: 30 + check-codeowners: runs-on: ubuntu-24.04 if: ${{ github.actor != 'dependabot[bot]' }} steps: - uses: actions/checkout@v4 - - uses: actions/setup-go@v5 - with: - go-version: "1.22.8" - cache: false - - name: Cache Go - id: go-cache + + - name: Cache Go Tools + id: go-tools-cache timeout-minutes: 5 uses: actions/cache@v4 with: path: | - ~/go/bin - ~/go/pkg/mod ./.tools - key: go-cache-${{ runner.os }}-${{ hashFiles('**/go.sum') }} - check-codeowners: - runs-on: ubuntu-24.04 - needs: [setup-environment] - steps: - - uses: actions/checkout@v4 - - name: Gen githubgen tool - if: github.repository == 'open-telemetry/opentelemetry-collector-contrib' + key: go-tools-${{ runner.os }}-${{ hashFiles('internal/tools/go.sum') }} + + - name: Install tools + if: github.repository == 'open-telemetry/opentelemetry-collector-contrib' && steps.go-tools-cache.outputs.cache-hit != 'true' run: | - make githubgen-install - echo "$(go env GOPATH)/bin" >> $GITHUB_PATH + make install-tools + - uses: actions/checkout@v4 with: ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} path: pr + - name: Gen CODEOWNERS run: | cd pr - GITHUB_TOKEN=${{ secrets.READ_ORG_AND_USER_TOKEN }} githubgen + GITHUB_TOKEN=${{ secrets.READ_ORG_AND_USER_TOKEN }} ./.tools/githubgen codeowners git diff -s --exit-code || (echo 'Generated code is out of date, please apply this diff and commit the changes in this PR.' && git diff && exit 1)