-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CI: Add job for 'needs maintainer approval' PR tag
- Loading branch information
Showing
1 changed file
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
name: Pull Request Requires Maintainer Approval | ||
on: | ||
pull_request: | ||
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: Remove needs triage / under review if reproduced | ||
if: github.event.label.name == 'reproduced' | ||
run: | | ||
gh issue edit --repo duckdb/duckdb ${{ github.event.issue.number }} --remove-label "needs triage" --remove-label "under review" | ||
- name: Remove needs triage / reproduced if under review | ||
if: github.event.label.name == 'under review' | ||
run: | | ||
gh issue edit --repo duckdb/duckdb ${{ github.event.issue.number }} --remove-label "needs triage" --remove-label "reproduced" | ||
- name: Get mirror issue number | ||
run: | | ||
gh issue list --repo duckdblabs/duckdb-internal --json title,number --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: Set label environment variable | ||
run: | | ||
if ${{ github.event.label.name == 'reproduced' }}; then | ||
echo "LABEL=needs label" >> $GITHUB_ENV | ||
echo "UNLABEL=needs triage" >> $GITHUB_ENV | ||
else | ||
echo "LABEL=needs triage" >> $GITHUB_ENV | ||
echo "UNLABEL=needs label" >> $GITHUB_ENV | ||
fi | ||
- name: Create or label issue | ||
run: | | ||
if [ "$MIRROR_ISSUE_NUMBER" == "" ]; then | ||
gh issue create --repo duckdblabs/duckdb-internal --label "$LABEL" --label "pull request" --title "$TITLE_PREFIX - $PUBLIC_PR_TITLE" --body "See https://github.com/duckdb/duckdb/pull/${{ github.event.pull_request.number }}" | ||
else | ||
gh issue edit --repo duckdblabs/duckdb-internal $MIRROR_ISSUE_NUMBER --remove-label "$UNLABEL" --add-label "$LABEL" | ||
fi |