Debian Codegraph @

.github/workflows/check-codeowners.yaml

raw
1 name: codeowners
2 on:
3 push:
4 branches: [main]
5 paths:
6 - ".github/CODEOWNERS"
7 - "**/metadata.yaml"
8 tags:
9 - "v[0-9]+.[0-9]+.[0-9]+*"
10 pull_request_target:
11 paths:
12 - ".github/CODEOWNERS"
13 - "**/metadata.yaml"
14 types:
15 - opened
16 - synchronize
17 - edited
18 - reopened
19 env:
20 # Make sure to exit early if cache segment download times out after 2 minutes.
21 # We limit cache download as a whole to 5 minutes.
22 SEGMENT_DOWNLOAD_TIMEOUT_MINS: 2
23
24 # Do not cancel this workflow on main. See https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/16616
25 concurrency:
26 group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
27 cancel-in-progress: true
28
29 permissions: read-all
30
31 jobs:
32 check-codeowners:
33 timeout-minutes: 30
34 runs-on: ubuntu-24.04
35 if: ${{ github.actor != 'dependabot[bot]' && github.repository == 'open-telemetry/opentelemetry-collector' }}
36 steps:
37 - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6
38
39 - uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6
40 id: go-setup
41 with:
42 go-version: oldstable
43 cache-dependency-path: "**/*.sum"
44
45 - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6
46 with:
47 ref: ${{github.event.pull_request.head.ref}}
48 repository: ${{github.event.pull_request.head.repo.full_name}}
49 path: pr
50
51 - uses: actions/create-github-app-token@7e473efe3cb98aa54f8d4bac15400b15fad77d94 # v2.2.0
52 id: otelbot-token
53 with:
54 app-id: ${{ vars.OTELBOT_APP_ID }}
55 private-key: ${{ secrets.OTELBOT_PRIVATE_KEY }}
56
57 # NOTE: the make command below intentionally uses the Makefile from the
58 # target branch, and not the PR checkout, since it runs with the
59 # pull_request_target event and has elevated permissions.
60 - name: Gen CODEOWNERS
61 run: |
62 GITHUB_TOKEN=${{ steps.otelbot-token.outputs.token }} GITHUBGEN_ARGS="-folder=./pr" make generate-codeowners
63 git diff -s --exit-code || (echo 'Generated code is out of date, please run "make generate-codeowners" or apply this diff and commit the changes in this PR.' && git diff && exit 1)