Skip to content

chore(release): release v0.4.5 #17

chore(release): release v0.4.5

chore(release): release v0.4.5 #17

name: Dependabot review and auto-merge
on:
pull_request:
types:
- opened
- reopened
- ready_for_review
- synchronize
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
permissions:
contents: write
pull-requests: write
jobs:
review-and-enable-auto-merge:
if: >-
github.event.pull_request.user.login == 'dependabot[bot]' &&
github.repository == 'acgetchell/la-stack'
runs-on: ubuntu-latest
steps:
- name: Request CodeRabbit review
env:
# Dependabot-triggered workflows receive Dependabot secrets.
GH_TOKEN: ${{ secrets.CODERABBIT_REVIEW_TOKEN }}
PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
PR_NUMBER: ${{ github.event.pull_request.number }}
REPOSITORY: ${{ github.repository }}
run: |
if [[ -z "$GH_TOKEN" ]]; then
echo "::error::CODERABBIT_REVIEW_TOKEN is not configured."
exit 1
fi
token_owner="$(gh api user --jq '.login')"
if [[ "$token_owner" != "acgetchell" ]]; then
echo "::error::CODERABBIT_REVIEW_TOKEN must belong to acgetchell."
exit 1
fi
marker="<!-- coderabbit-review-request:${PR_HEAD_SHA} -->"
comments="$(
gh api --paginate \
"repos/${REPOSITORY}/issues/${PR_NUMBER}/comments" \
--jq '.[] | select(.user.login == "acgetchell") | .body'
)"
if grep -Fxq -- "$marker" <<< "$comments"; then
echo "CodeRabbit review already requested for ${PR_HEAD_SHA}."
exit 0
fi
body="$(printf '@coderabbitai review\n\n%s' "$marker")"
gh api \
--method POST \
"repos/${REPOSITORY}/issues/${PR_NUMBER}/comments" \
--raw-field body="$body"
- name: Enable auto-merge
env:
GH_TOKEN: ${{ github.token }}
PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
PR_URL: ${{ github.event.pull_request.html_url }}
run: gh pr merge --auto --squash --match-head-commit "$PR_HEAD_SHA" "$PR_URL"