Skip to content

maa-core 5.9.0

maa-core 5.9.0 #247

Workflow file for this run

name: Publish Bottles and Merge PR
on:
pull_request_target:
types:
- labeled
defaults:
run:
shell: bash
jobs:
pr-pull:
if: contains(github.event.pull_request.labels.*.name, 'Automerge')
runs-on: ubuntu-22.04
container:
image: ghcr.io/homebrew/ubuntu22.04:master
permissions:
actions: write
pull-requests: write
contents: write
packages: write
steps:
- name: Set up Homebrew
id: set-up-homebrew
uses: Homebrew/actions/setup-homebrew@master
with:
core: false
cask: false
test-bot: false
- name: Cache Homebrew Bundler RubyGems
id: cache
uses: actions/cache@v4
with:
path: ${{ steps.set-up-homebrew.outputs.gems-path }}
key: ${{ runner.os }}-rubygems-${{ steps.set-up-homebrew.outputs.gems-hash }}
restore-keys: ${{ runner.os }}-rubygems-
- name: Install Homebrew Bundler RubyGems
if: steps.cache.outputs.cache-hit != 'true'
run: brew install-bundler-gems
- name: Configure Git User
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Checkout PR Branch
working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }}
env:
GH_TOKEN: ${{ github.token }}
run: gh pr checkout ${{ github.event.pull_request.number }}
- name: Pull and Publish Bottles
env:
HOMEBREW_GITHUB_API_TOKEN: ${{ github.token }}
HOMEBREW_GITHUB_PACKAGES_TOKEN: ${{ github.token }}
HOMEBREW_GITHUB_PACKAGES_USER: ${{ github.actor }}
PULL_REQUEST: ${{ github.event.pull_request.number }}
run: |
brew pr-pull \
--debug \
--clean \
--no-cherry-pick \
--artifact-pattern 'bottles_*' \
--tap="$GITHUB_REPOSITORY" \
--workflows ci.yml \
'${{ github.event.pull_request.number }}'
- name: Push commits to PR branch
uses: Homebrew/actions/git-try-push@master
with:
token: ${{ github.token }}
branch: ${{ github.event.pull_request.head.ref }}
remote: ${{ github.event.pull_request.head.repo.clone_url }}
directory: ${{ steps.set-up-homebrew.outputs.repository-path }}
- name: Wait for Remote Branch to be Updated
working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }}
run: |
local_head=$(git rev-parse HEAD)
remote_ref='pull/${{ github.event.pull_request.number }}/head'
attempt=0
max_attempts=10
timeout=1
# Wait (with exponential backoff) until the PR branch is in sync
while [[ "$attempt" -lt "$max_attempts" ]]; do
remote_head="$(git ls-remote origin "$remote_ref" | cut -f1)"
if [[ "$local_head" = "$remote_head" ]]
then
success=1
break
fi
sleep "$timeout"
attempt=$(( attempt + 1 ))
timeout=$(( timeout * 2 ))
done
if [[ "$success" -ne 1 ]]; then
echo "Remote branch not updated after ${max_attempts} attempts"
exit 1
fi
- name: Approve Pull Request
working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }}
env:
GH_TOKEN: ${{ github.token }}
run: |
gh pr review '${{ github.event.pull_request.number }}' --approve
- name: Enable Auto Merge
working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }}
env:
GH_TOKEN: ${{ github.token }}
run: |
gh pr merge '${{ github.event.pull_request.number }}' \
--merge \
--delete-branch