From aa26f3130a51ad7eec6177aa94f2e536e5709b2f Mon Sep 17 00:00:00 2001 From: titusfortner Date: Fri, 19 Jan 2024 08:42:25 -0600 Subject: [PATCH 1/3] [build] create workflow to PR changes to browser versions --- .github/workflows/bazel.yml | 9 ++++++ .github/workflows/pin-browsers.yml | 46 ++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 .github/workflows/pin-browsers.yml diff --git a/.github/workflows/bazel.yml b/.github/workflows/bazel.yml index 70dfd17205a53..fc406943faf71 100644 --- a/.github/workflows/bazel.yml +++ b/.github/workflows/bazel.yml @@ -140,3 +140,12 @@ jobs: title: "Nightly" prerelease: true files: ${{ inputs.nightly-release-files }} + - name: Save changes + run: | + git diff > changes.patch + - name: "Upload changes" + uses: actions/upload-artifact@v3 + with: + name: patch-file + path: changes.patch + retention-days: 6 diff --git a/.github/workflows/pin-browsers.yml b/.github/workflows/pin-browsers.yml new file mode 100644 index 0000000000000..cecde00305ac2 --- /dev/null +++ b/.github/workflows/pin-browsers.yml @@ -0,0 +1,46 @@ +name: Pin Browsers +on: + schedule: + - cron: 10 0 * * * + workflow_dispatch: + +jobs: + update: + name: Update Pinned Browsers + uses: ./.github/workflows/bazel.yml + with: + name: Pin Browsers + cache-key: pin-browsers + run: bazel run //scripts:pinned_browsers + + pull-request: + runs-on: ubuntu-latest + needs: update + steps: + - name: Checkout repository + uses: actions/checkout@v2 + - name: Download patch + uses: actions/download-artifact@v2 + with: + name: patch-file + - name: Apply Patch + run: | + git apply changes.patch + rm changes.patch + - name: Check Changes + run: | + if [[ -n $(git status --porcelain common/repositories.bzl) ]]; then + echo "CHANGES_FOUND=true" >> $GITHUB_ENV + fi + - name: Create Pull Request + if: env.CHANGES_FOUND == 'true' + uses: peter-evans/create-pull-request@v5 + with: + token: ${{ secrets.SELENIUM_CI_TOKEN }} + add-paths: common/repositories.bzl + commit-message: Update pinned browser versions + committer: Selenium CI Bot + author: Selenium CI Bot + title: "Automated Browser Version Update" + body: "This is an automated pull request to update pinned browsers and drivers" + branch: "pinned-browser-updates" From 8389160365a99214148523beac92fb1bdf26a856 Mon Sep 17 00:00:00 2001 From: titusfortner Date: Fri, 19 Jan 2024 09:05:21 -0600 Subject: [PATCH 2/3] use latest versions of actions --- .github/workflows/pin-browsers.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pin-browsers.yml b/.github/workflows/pin-browsers.yml index cecde00305ac2..5ccee21a2372f 100644 --- a/.github/workflows/pin-browsers.yml +++ b/.github/workflows/pin-browsers.yml @@ -18,9 +18,9 @@ jobs: needs: update steps: - name: Checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Download patch - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: patch-file - name: Apply Patch From 0bd13b105e9bf9be255175c401904550cb2ec6fd Mon Sep 17 00:00:00 2001 From: titusfortner Date: Sat, 20 Jan 2024 09:41:39 -0600 Subject: [PATCH 3/3] [ci] restrict job from running on forks --- .github/workflows/pin-browsers.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pin-browsers.yml b/.github/workflows/pin-browsers.yml index 5ccee21a2372f..686c1706b2548 100644 --- a/.github/workflows/pin-browsers.yml +++ b/.github/workflows/pin-browsers.yml @@ -14,6 +14,7 @@ jobs: run: bazel run //scripts:pinned_browsers pull-request: + if: github.repository_owner == 'seleniumhq' runs-on: ubuntu-latest needs: update steps: