From 204ef3c7845cfc4dded57f1e02a77dccf24f4bc4 Mon Sep 17 00:00:00 2001 From: Antoine Toulme Date: Tue, 10 Dec 2024 18:47:27 -0800 Subject: [PATCH 1/6] [chore] add a job to update-otel daily --- .github/workflows/update-otel-cron.yml | 32 ++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/workflows/update-otel-cron.yml diff --git a/.github/workflows/update-otel-cron.yml b/.github/workflows/update-otel-cron.yml new file mode 100644 index 000000000000..b8ee4e91ded6 --- /dev/null +++ b/.github/workflows/update-otel-cron.yml @@ -0,0 +1,32 @@ +name: 'Update contrib to the latest core source' +on: + schedule: + - cron: "27 21 * * *" # Run at an arbitrary time on weekdays. + +jobs: + update-otel: + runs-on: ubuntu-24.04 + if: ${{ github.repository_owner == 'open-telemetry' }} + steps: + - uses: actions/checkout@v4 + - name: Update to latest opentelemetry-collector release + run: make update-otel + - name: Create pull request against main + env: + # not using secrets.GITHUB_TOKEN since pull requests from that token do not run workflows + GH_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }} + run: | + message="[chore] Update to latest opentelemetry-collector" + body="Update to latest opentelemetry-collector release." + branch="opentelemetrybot/update-otel" + + git checkout -b $branch + git commit -a -m "$message" + git push --set-upstream origin $branch + url=$(gh pr create --title "$message" \ + --body "$body" \ + --base main) + + pull_request_number=${url//*\//} + git push + From 40df50019f285951471a184bb4c734fe330a404a Mon Sep 17 00:00:00 2001 From: Antoine Toulme Date: Wed, 11 Dec 2024 00:16:43 -0800 Subject: [PATCH 2/6] Update .github/workflows/update-otel-cron.yml Co-authored-by: Moritz Wiesinger --- .github/workflows/update-otel-cron.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-otel-cron.yml b/.github/workflows/update-otel-cron.yml index b8ee4e91ded6..909ec573b1fb 100644 --- a/.github/workflows/update-otel-cron.yml +++ b/.github/workflows/update-otel-cron.yml @@ -6,7 +6,7 @@ on: jobs: update-otel: runs-on: ubuntu-24.04 - if: ${{ github.repository_owner == 'open-telemetry' }} + if: github.repository_owner == 'open-telemetry' steps: - uses: actions/checkout@v4 - name: Update to latest opentelemetry-collector release From 8ec5221b24fab16ce31486c34d0588dce67b3d2a Mon Sep 17 00:00:00 2001 From: Antoine Toulme Date: Fri, 13 Dec 2024 20:48:29 -0800 Subject: [PATCH 3/6] turn on running the job on pull request, see if it runs ok --- .github/workflows/update-otel-cron.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/update-otel-cron.yml b/.github/workflows/update-otel-cron.yml index 909ec573b1fb..993554d9abe4 100644 --- a/.github/workflows/update-otel-cron.yml +++ b/.github/workflows/update-otel-cron.yml @@ -1,5 +1,6 @@ name: 'Update contrib to the latest core source' on: + pull_request: schedule: - cron: "27 21 * * *" # Run at an arbitrary time on weekdays. From fd0536d2d3c296e75672e1800b4f41129ccab386 Mon Sep 17 00:00:00 2001 From: Antoine Toulme Date: Fri, 13 Dec 2024 20:53:43 -0800 Subject: [PATCH 4/6] check out core in same path --- .github/workflows/update-otel-cron.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/update-otel-cron.yml b/.github/workflows/update-otel-cron.yml index 993554d9abe4..789379548794 100644 --- a/.github/workflows/update-otel-cron.yml +++ b/.github/workflows/update-otel-cron.yml @@ -10,13 +10,21 @@ jobs: if: github.repository_owner == 'open-telemetry' steps: - uses: actions/checkout@v4 + with: + path: opentelemetry-collector + repository: open-telemetry/opentelemetry-collector + ref: main + - uses: actions/checkout@v4 + with: + path: opentelemetry-collector-contrib - name: Update to latest opentelemetry-collector release - run: make update-otel + run: cd opentelemetry-collector-contrib && make update-otel - name: Create pull request against main env: # not using secrets.GITHUB_TOKEN since pull requests from that token do not run workflows GH_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }} run: | + cd opentelemetry-collector-contrib message="[chore] Update to latest opentelemetry-collector" body="Update to latest opentelemetry-collector release." branch="opentelemetrybot/update-otel" From e5ecbd12bffae0bc35171eb85328894bae57976e Mon Sep 17 00:00:00 2001 From: Antoine Toulme Date: Fri, 13 Dec 2024 20:57:23 -0800 Subject: [PATCH 5/6] use peter-evans/create-pull-request@v7 --- .github/workflows/update-otel-cron.yml | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/.github/workflows/update-otel-cron.yml b/.github/workflows/update-otel-cron.yml index 789379548794..034e1d9e3b70 100644 --- a/.github/workflows/update-otel-cron.yml +++ b/.github/workflows/update-otel-cron.yml @@ -20,22 +20,10 @@ jobs: - name: Update to latest opentelemetry-collector release run: cd opentelemetry-collector-contrib && make update-otel - name: Create pull request against main - env: - # not using secrets.GITHUB_TOKEN since pull requests from that token do not run workflows - GH_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }} - run: | - cd opentelemetry-collector-contrib - message="[chore] Update to latest opentelemetry-collector" - body="Update to latest opentelemetry-collector release." - branch="opentelemetrybot/update-otel" - - git checkout -b $branch - git commit -a -m "$message" - git push --set-upstream origin $branch - url=$(gh pr create --title "$message" \ - --body "$body" \ - --base main) - - pull_request_number=${url//*\//} - git push + uses: peter-evans/create-pull-request@v7 + with: + branch: opentelemetrybot/update-otel + token: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }} + commit-message: Update to latest opentelemetry-collector release. + title: "[chore] Update to latest opentelemetry-collector" From ff6b91f2a87c20f4f0f496ec16b4d67ba5f43850 Mon Sep 17 00:00:00 2001 From: Antoine Toulme Date: Fri, 13 Dec 2024 21:39:14 -0800 Subject: [PATCH 6/6] set git info --- .github/workflows/update-otel-cron.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/update-otel-cron.yml b/.github/workflows/update-otel-cron.yml index 034e1d9e3b70..d3c03948550e 100644 --- a/.github/workflows/update-otel-cron.yml +++ b/.github/workflows/update-otel-cron.yml @@ -18,7 +18,11 @@ jobs: with: path: opentelemetry-collector-contrib - name: Update to latest opentelemetry-collector release - run: cd opentelemetry-collector-contrib && make update-otel + run: | + cd opentelemetry-collector-contrib + git config user.name opentelemetrybot + git config user.email 107717825+opentelemetrybot@users.noreply.github.com + make update-otel - name: Create pull request against main uses: peter-evans/create-pull-request@v7 with: