Skip to content

chore(main): release 0.212.0 #749

chore(main): release 0.212.0

chore(main): release 0.212.0 #749

name: Request Auto-Merge

Check warning on line 1 in sqlstack-io/.github/.github/workflows/auto-merge.yml

View workflow run for this annotation

GitHub Actions / Request Auto-Merge

Workflow execution policy warning (evaluate mode)

On December 2, 2026, GitHub will restrict `pull_request_target` on public repositories by default. To continue allowing the event trigger, configure an Actions policy. Learn more: https://gh.io/securely-using-pull_request_target#default-policy-for-pull_request_target
on:
pull_request_target:
types: [opened, synchronize, reopened, ready_for_review]
# Repositories with a merge queue require this workflow on the queue's merge groups too. There is
# nothing to request there; the merge-group job only lets the run conclude as a success.
merge_group:
permissions:
contents: read
pull-requests: read
jobs:
merge-group:
if: github.event_name == 'merge_group'
runs-on: ubuntu-latest
steps:
- name: Nothing to request for a merge group
run: echo "The merge queue's required checks decide this merge."
request-auto-merge:
if: >-
github.event_name == 'pull_request_target' &&
!github.event.pull_request.draft &&
github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
steps:
- name: Create delivery token
id: delivery-token
uses: actions/create-github-app-token@v2
with:
app-id: ${{ vars.CHIO_DELIVERY_APP_ID }}
private-key: ${{ secrets.CHIO_DELIVERY_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
repositories: ${{ github.event.repository.name }}
- name: Request squash auto-merge
env:
GH_TOKEN: ${{ steps.delivery-token.outputs.token }}
PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
PR_URL: ${{ github.event.pull_request.html_url }}
BASE_REF: ${{ github.event.pull_request.base.ref }}
# gh refuses --delete-branch when the base branch has a merge queue, so ask for it only
# where there is none. With a queue, the repository's delete-on-merge setting removes it.
run: |
args=(--repo "$GITHUB_REPOSITORY" --auto --squash --match-head-commit "$PR_HEAD_SHA")
queue=$(gh api graphql \
-f query='query($owner: String!, $name: String!, $branch: String!) {
repository(owner: $owner, name: $name) { mergeQueue(branch: $branch) { id } } }' \
-f owner="${GITHUB_REPOSITORY%%/*}" -f name="${GITHUB_REPOSITORY#*/}" -f branch="$BASE_REF" \
--jq '.data.repository.mergeQueue.id // ""')
if [ -z "$queue" ]; then
args+=(--delete-branch)
fi
gh pr merge "$PR_URL" "${args[@]}"