35 lines
1.5 KiB
YAML
35 lines
1.5 KiB
YAML
name: Pull Request Requires Maintainer Approval
|
|
on:
|
|
pull_request_target:
|
|
types:
|
|
- labeled
|
|
|
|
env:
|
|
GH_TOKEN: ${{ secrets.DUCKDBLABS_BOT_TOKEN }}
|
|
TITLE_PREFIX: "[duckdb/#${{ github.event.pull_request.number }}]"
|
|
PUBLIC_PR_TITLE: ${{ github.event.pull_request.title }}
|
|
|
|
jobs:
|
|
create_or_label_issue:
|
|
if: github.event.label.name == 'needs maintainer approval'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Get mirror issue number
|
|
run: |
|
|
gh issue list --repo duckdblabs/duckdb-internal --search "${TITLE_PREFIX}" --json title,number --state all --jq ".[] | select(.title | startswith(\"${TITLE_PREFIX}\")).number" > mirror_issue_number.txt
|
|
echo "MIRROR_ISSUE_NUMBER=$(cat mirror_issue_number.txt)" >> ${GITHUB_ENV}
|
|
|
|
- name: Print whether mirror issue exists
|
|
run: |
|
|
if [ "${MIRROR_ISSUE_NUMBER}" == "" ]; then
|
|
echo "Mirror issue with title prefix '${TITLE_PREFIX}' does not exist yet"
|
|
else
|
|
echo "Mirror issue with title prefix '${TITLE_PREFIX}' exists with number ${MIRROR_ISSUE_NUMBER}"
|
|
fi
|
|
|
|
- name: Create or label issue
|
|
run: |
|
|
if [ "${MIRROR_ISSUE_NUMBER}" == "" ]; then
|
|
gh issue create --repo duckdblabs/duckdb-internal --label "external action required" --label "Pull request" --title "${TITLE_PREFIX} - ${PUBLIC_PR_TITLE}" --body "Pull request ${TITLE_PREFIX} needs input from maintainers. See https://github.com/duckdb/duckdb/pull/${{ github.event.pull_request.number }}"
|
|
fi
|