From 00ec63e49a731511de15029a530335788118909c Mon Sep 17 00:00:00 2001 From: Tony Hsu Date: Fri, 20 Sep 2024 12:17:54 +0200 Subject: [PATCH 1/3] Use PAT --- .github/workflows/auto-update-gemfiles.yml | 7 ++++--- .github/workflows/lock-dependency.yml | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/auto-update-gemfiles.yml b/.github/workflows/auto-update-gemfiles.yml index 3867600e904..5f20a18304b 100644 --- a/.github/workflows/auto-update-gemfiles.yml +++ b/.github/workflows/auto-update-gemfiles.yml @@ -5,7 +5,7 @@ on: - cron: '0 0 * * 0' # Every Sunday at midnight push: branches: - - quinna/update-gemfiles-workflow # TODO: remove, for testing + - tonycthsu/pat # TODO: remove, for testing workflow_dispatch: concurrency: @@ -83,12 +83,13 @@ jobs: path: gemfiles pattern: gha${{ github.run_id }}-datadog-gem-* merge-multiple: true - + - run: git diff - name: Create Pull Request uses: peter-evans/create-pull-request@v7 with: + token: ${{ secrets.GHA_PAT }} branch: update-latest-gemfiles commit-message: "update latest gemfiles, workflow run: ${{ github.run_id }}" delete-branch: true @@ -102,4 +103,4 @@ jobs: Merge if green, otherwise add to backlog. The default behavior is to create a pull request that will be continually updated with new changes - until it is merged or closed. + until it is merged or closed. diff --git a/.github/workflows/lock-dependency.yml b/.github/workflows/lock-dependency.yml index b226b135bc2..432d1f44d0d 100644 --- a/.github/workflows/lock-dependency.yml +++ b/.github/workflows/lock-dependency.yml @@ -117,6 +117,8 @@ jobs: contents: write steps: - uses: actions/checkout@v4 + with: + token: ${{ secrets.GHA_PAT }} - uses: actions/download-artifact@v4 with: path: gemfiles From 699aad5b04d81a15f51336cb71765ffe0cc6230a Mon Sep 17 00:00:00 2001 From: Tony Hsu Date: Fri, 20 Sep 2024 12:48:23 +0200 Subject: [PATCH 2/3] Update PR body --- .github/workflows/lock-dependency.yml | 3 +-- ...files.yml => update-latest-dependency.yml} | 24 +++++++------------ 2 files changed, 9 insertions(+), 18 deletions(-) rename .github/workflows/{auto-update-gemfiles.yml => update-latest-dependency.yml} (77%) diff --git a/.github/workflows/lock-dependency.yml b/.github/workflows/lock-dependency.yml index 432d1f44d0d..65e0346c1ea 100644 --- a/.github/workflows/lock-dependency.yml +++ b/.github/workflows/lock-dependency.yml @@ -106,6 +106,7 @@ jobs: with: name: lock-dependency-${{ github.run_id }}-${{ matrix.engine.name }}-${{ matrix.engine.version }} path: gemfiles/${{ matrix.engine.name }}_${{ matrix.engine.version }}* + retention-days: 1 # TODO: Change token to trigger workflow automation # > New commit by GITHUB_TOKEN does not trigger workflow automation to prevent infinite loop @@ -113,8 +114,6 @@ jobs: name: Commit changes needs: lock runs-on: ubuntu-latest - permissions: - contents: write steps: - uses: actions/checkout@v4 with: diff --git a/.github/workflows/auto-update-gemfiles.yml b/.github/workflows/update-latest-dependency.yml similarity index 77% rename from .github/workflows/auto-update-gemfiles.yml rename to .github/workflows/update-latest-dependency.yml index 5f20a18304b..6024878b6a9 100644 --- a/.github/workflows/auto-update-gemfiles.yml +++ b/.github/workflows/update-latest-dependency.yml @@ -1,4 +1,4 @@ -name: Auto-update Gemfiles +name: "Update Latest Dependency" on: schedule: @@ -64,15 +64,11 @@ jobs: with: name: 'gha${{ github.run_id }}-datadog-gem-${{ matrix.engine.name }}-${{ matrix.engine.version }}' path: gemfiles/${{ matrix.engine.name }}_${{ matrix.engine.version }}_* - retention-days: 3 + retention-days: 1 aggregate: needs: build runs-on: ubuntu-latest - permissions: - actions: read - contents: write - pull-requests: write steps: - name: Checkout code uses: actions/checkout@v4 @@ -90,17 +86,13 @@ jobs: uses: peter-evans/create-pull-request@v7 with: token: ${{ secrets.GHA_PAT }} - branch: update-latest-gemfiles - commit-message: "update latest gemfiles, workflow run: ${{ github.run_id }}" - delete-branch: true + branch: auto-generate/update-latest-dependencies + title: '[🤖] Update Latest Dependency' base: master - title: 'Update Latest Gemfiles' labels: dev/internal, integrations + commit-message: "[🤖] Update Latest Dependency: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" + delete-branch: true body: | - This is an auto-generated PR from 'Auto-update Gemfiles' workflow. - The PR updates the integration gemfiles to latest versions of dependencies. - - Merge if green, otherwise add to backlog. + _This is an auto-generated PR from [here](https://github.com/DataDog/dd-trace-rb/blob/master/.github/workflows/auto-update-gemfiles.yml), which creates a pull request that will be continually updated with new changes until it is merged or closed)_ - The default behavior is to create a pull request that will be continually updated with new changes - until it is merged or closed. + The PR updates latest versions of defined dependencies. Please review the changes and merge when ready. From 0e07e43a001f9548eeb518dcce17aeb08559b843 Mon Sep 17 00:00:00 2001 From: Tony Hsu Date: Fri, 20 Sep 2024 13:09:50 +0200 Subject: [PATCH 3/3] Remove before merge --- .github/workflows/update-latest-dependency.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/update-latest-dependency.yml b/.github/workflows/update-latest-dependency.yml index 6024878b6a9..378252aaecf 100644 --- a/.github/workflows/update-latest-dependency.yml +++ b/.github/workflows/update-latest-dependency.yml @@ -3,9 +3,6 @@ name: "Update Latest Dependency" on: schedule: - cron: '0 0 * * 0' # Every Sunday at midnight - push: - branches: - - tonycthsu/pat # TODO: remove, for testing workflow_dispatch: concurrency: @@ -93,6 +90,6 @@ jobs: commit-message: "[🤖] Update Latest Dependency: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" delete-branch: true body: | - _This is an auto-generated PR from [here](https://github.com/DataDog/dd-trace-rb/blob/master/.github/workflows/auto-update-gemfiles.yml), which creates a pull request that will be continually updated with new changes until it is merged or closed)_ + _This is an auto-generated PR from [here](https://github.com/DataDog/dd-trace-rb/blob/master/.github/workflows/update-latest-dependency.yml), which creates a pull request that will be continually updated with new changes until it is merged or closed)_ The PR updates latest versions of defined dependencies. Please review the changes and merge when ready.