Skip to content
This repository was archived by the owner on May 3, 2025. It is now read-only.

build(deps): bump github/codeql-action from 3.28.8 to 3.28.16 #33

build(deps): bump github/codeql-action from 3.28.8 to 3.28.16

build(deps): bump github/codeql-action from 3.28.8 to 3.28.16 #33

Workflow file for this run

name: brew pr-pull
on:
pull_request_target:
types:
- labeled
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: false
permissions:
actions: read
contents: write
packages: write
pull-requests: write
env:
GH_REPO: ${{ github.repository }}
PR: ${{ github.event.pull_request.number }}
jobs:
pr-pull:
if: contains(github.event.pull_request.labels.*.name, 'pr-pull')
runs-on: ubuntu-22.04
container:
image: ghcr.io/homebrew/ubuntu22.04:master
options: --user=linuxbrew
defaults:
run:
shell: bash
working-directory: /github/home
steps:
- name: Set up Homebrew
id: set-up-homebrew
uses: Homebrew/actions/setup-homebrew@master
- name: Set up git
uses: Homebrew/actions/git-user-config@master
- name: Checkout PR branch
working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }}
env:
GH_TOKEN: ${{ github.token }}
run: gh pr checkout "$PR"
- name: Pull bottles
id: brew-pr-pull
working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }}
env:
HOMEBREW_GITHUB_API_TOKEN: ${{ github.token }}
HOMEBREW_GITHUB_PACKAGES_TOKEN: ${{ github.token }}
HOMEBREW_GITHUB_PACKAGES_USER: ${{ github.repository_owner }}
run: |
brew pr-pull \
--debug \
--clean \
--no-cherry-pick \
--tap="$GH_REPO" \
--workflows=tests.yml \
"$PR"
echo "head_sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
- name: Push commits
uses: Homebrew/actions/git-try-push@master
with:
token: ${{ github.token }}
directory: ${{ steps.set-up-homebrew.outputs.repository-path }}
branch: ${{ github.head_ref }}
- name: Remove `pr-pull` label on failure
if: failure()
working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }}
env:
GH_TOKEN: ${{ github.token }}
run: |
gh pr edit --remove-label='pr-pull' "$PR"
- name: Wait until PR branch is in sync with local repository
working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }}
env:
EXPECTED_SHA: ${{ steps.brew-pr-pull.outputs.head_sha }}
run: |
echo "::notice::Local repository HEAD: $EXPECTED_SHA"
# Wait (with exponential backoff) until the PR branch is in sync
max_attempts=10
attempt=0
timeout=1
while [[ "$attempt" -lt "$max_attempts" ]]
do
remote_head="$(git ls-remote origin "pull/$PR/head" | cut -f1)"
if [[ "$remote_head" = "$EXPECTED_SHA" ]]
then
success=1
break
fi
echo "::notice::Remote repository not in sync. Checking again in ${timeout}s..."
sleep "$timeout"
attempt=$(( attempt + 1 ))
timeout=$(( timeout * 2 ))
done
# One last check...
if [[ -z "$success" ]] &&
[[ "$(git ls-remote origin "pull/$PR/head" | cut -f1)" != "$EXPECTED_SHA" ]]
then
echo "::error::No attempts remaining. Giving up."
exit 1
fi
- name: Merge PR
working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }}
env:
GH_TOKEN: ${{ github.token }}
EXPECTED_SHA: ${{ steps.brew-pr-pull.outputs.head_sha }}
run: |
gh pr merge \
--delete-branch \
--match-head-commit="$EXPECTED_SHA" \
--merge \
"$PR"