Skip to content

[AI Chat] fix issues with conversation context menu #781

[AI Chat] fix issues with conversation context menu

[AI Chat] fix issues with conversation context menu #781

name: Rerun Compare Chromium versions
on:
pull_request:
branches:
- master
- '[0-9]+.[0-9]+.x'
## TODO: If a PR touches >300 files, this filter may prevent the workflow from being executed (https://github.com/orgs/community/discussions/57830)
# paths:
# - package.json
types:
- closed
jobs:
rerun-compare-chromium-versions:
## 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 }}
# TODO: This is the sha where the PR branched off, so not really what we want, but there seems to be no easy way to get the last pre-merge sha without a checkout
TARGET_SHA: ${{ github.event.pull_request.base.sha }}
steps:
- 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
chromium_ver() {
gh api -H "Accept: application/vnd.github.raw+json" "https://api.github.com/repos/${GITHUB_REPOSITORY:?}/contents/package.json?ref=${1:?}"|jq -r .config.projects.chrome.tag
}
pr_ver="$(chromium_ver "${PR_SHA:?}")"
target_ver="$(chromium_ver "${TARGET_SHA:?}")"
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:?}"
if [[ "$run_id" ]]; then
echo "Rerunning $run_id for $pr_url"
# TODO: Workflows older than 30 days will fail to rerun (by design), let's filter them out (using `|| true` for now)
# https://docs.github.com/en/actions/managing-workflow-runs-and-deployments/managing-workflow-runs/re-running-workflows-and-jobs
gh -R "$GITHUB_REPOSITORY" run rerun "$run_id" || true
else
echo "No run found for $pr_url"
fi
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 "::notice::Chromium major versions match, nothing to do"
fi