Skip to content

Pre-release 0.49.175 #7

Pre-release 0.49.175

Pre-release 0.49.175 #7

name: Auto-create Release PR
on:
push:
branches:
- 'release/**'
jobs:
create-pr:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4
- name: Create pull request
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
existing_pr_count="$(gh pr list \
--state open \
--base main \
--head "${{ github.ref_name }}" \
--json number \
--jq 'length')"
if [ "${existing_pr_count}" -gt 0 ]; then
echo "Open pull request already exists for branch '${{ github.ref_name }}' into 'main'; skipping creation."
else
gh pr create \
--title "$(git log -1 --pretty=%s)" \
--body "Automated release PR." \
--base main \
--head "${{ github.ref_name }}"
fi
- name: Approve pull request
env:
# PAT stored in github/CopilotForXcode, with write permissions to pull requests
GH_TOKEN: ${{ secrets.XCODE_AUTO_APPROVE }}
run: |
gh pr review --approve "${{ github.ref_name }}"
- name: Wait for required checks
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
for i in $(seq 1 60); do
other_checks=$(gh pr checks "${{ github.ref_name }}" | grep -v "create-pr" || true)
if echo "$other_checks" | grep -wq "fail"; then
echo "Required checks failed."
exit 1
fi
if [ -z "$other_checks" ]; then
echo "No other checks found yet, waiting..."
elif ! echo "$other_checks" | grep -wq "pending"; then
echo "All required checks passed."
exit 0
fi
echo "Waiting for checks..."
sleep 10
done
echo "Timed out waiting for required checks."
exit 1
- name: Merge pull request
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr merge "${{ github.ref_name }}" \
--merge \
--delete-branch