Skip to content

Commit

Permalink
update check-codeowners workflow
Browse files Browse the repository at this point in the history
Signed-off-by: Moritz Wiesinger <[email protected]>
  • Loading branch information
mowies committed Jan 22, 2025
1 parent 442b4ab commit c091350
Showing 1 changed file with 12 additions and 21 deletions.
33 changes: 12 additions & 21 deletions .github/workflows/check-codeowners.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit c091350

Please sign in to comment.