Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workaround for rerun compare chromium versions (1.72.x) #26239

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions .github/workflows/rerun-compare-chromium-versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,25 @@ on:
branches:
- master
- '[0-9]+.[0-9]+.x'
paths:
- package.json
## TODO: If a PR touches >300 files, this filter may prevent the workflow from being executed
# paths:
# - package.json
types:
- closed

jobs:
rerun-compare-chromium-versions:
if: github.event.pull_request.merged == true
## TODO: Temporary workaround for the above issue
# if: github.event.pull_request.merged == true
if: github.event.pull_request.merged == true && startsWith(github.head_ref, 'cr1')
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_SHA: ${{ github.event.pull_request.head.sha }}
TARGET_SHA: ${{ github.event.pull_request.base.sha }}
steps:
- run: |
- name: If a major Chromium bump was merged, rerun compare-chromium-versions in all PRs targeting the same branch
run: |
shopt -s inherit_errexit
set -eEo pipefail

Expand All @@ -28,9 +32,10 @@ jobs:
pr_ver="$(chromium_ver "${PR_SHA:?}")"
target_ver="$(chromium_ver "${TARGET_SHA:?}")"

echo "::notice::PR branch: ${pr_ver:?}, target branch: ${target_ver:?}"
echo "::notice::PR branch: ${GITHUB_HEAD_REF:?} (${pr_ver:?}), target branch: ${GITHUB_BASE_REF:?} (${target_ver:?})"

if [[ "${pr_ver%%.*}" != "${target_ver%%.*}" ]]; then
echo "::notice::Rerunning compare-chromium-versions in PRs targeting ${GITHUB_BASE_REF:?}"
while read -r pr_number head_sha; do
run_id="$(gh api "/repos/$GITHUB_REPOSITORY/actions/workflows/compare-chromium-versions.yml/runs?head_sha=${head_sha:?}" -q '.workflow_runs[0].id')"
pr_url="https://github.com/brave/brave-core/pull/${pr_number:?}"
Expand All @@ -43,5 +48,5 @@ jobs:
sleep 1
done < <(gh -R "$GITHUB_REPOSITORY" pr list --limit 1000 --state open --base "$GITHUB_BASE_REF" --json number,headRefOid -q '.[]|"\(.number)\t\(.headRefOid)"')
else
echo "Chromium major versions match, nothing to do"
echo "::notice::Chromium major versions match, nothing to do"
fi
Loading