From 540f4ad5b3f961b5a4841b33596b0e1e90d614db Mon Sep 17 00:00:00 2001 From: Antoine Toulme Date: Thu, 28 Mar 2024 08:49:26 -0700 Subject: [PATCH 1/2] Run a check on codeowners, backed by a github token --- .github/workflows/build-and-test.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 398d45406977..8d14c9dba97f 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -224,6 +224,10 @@ jobs: run: | make gendistributions git diff -s --exit-code || (echo 'Generated code is out of date, please run "make gendistributions" and commit the changes in this PR.' && exit 1) + - name: Gen CODEOWNERS + run: | + GITHUB_TOKEN=${{ secrets.READ_ORG_AND_USER_TOKEN }} make gengithub + 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) - name: CodeGen run: | make -j2 generate From bd5feea13cd33de656249893797104510b92f6b1 Mon Sep 17 00:00:00 2001 From: Antoine Toulme Date: Thu, 28 Mar 2024 09:14:30 -0700 Subject: [PATCH 2/2] add a condition so it runs for main or tags only --- .github/workflows/build-and-test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 8d14c9dba97f..62a619186d91 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -225,6 +225,7 @@ jobs: make gendistributions git diff -s --exit-code || (echo 'Generated code is out of date, please run "make gendistributions" and commit the changes in this PR.' && exit 1) - name: Gen CODEOWNERS + if: (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')) && github.repository == 'open-telemetry/opentelemetry-collector-contrib' run: | GITHUB_TOKEN=${{ secrets.READ_ORG_AND_USER_TOKEN }} make gengithub 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)