Skip to content

Commit

Permalink
Merge pull request #71 from duckdb/ci-add-issue-mirroring-jobs
Browse files Browse the repository at this point in the history
CI: Add issue mirroring jobs
  • Loading branch information
szarnyasg authored Aug 24, 2024
2 parents 4440802 + 87083e8 commit 32528f5
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/InternalIssuesCreateMirror.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Create or Label Mirror Issue
on:
issues:
types:
- labeled

env:
GH_TOKEN: ${{ secrets.DUCKDBLABS_BOT_TOKEN }}
TITLE_PREFIX: "[duckdb-java/#${{ github.event.issue.number }}]"
PUBLIC_ISSUE_TITLE: ${{ github.event.issue.title }}

jobs:
create_or_label_issue:
if: github.event.label.name == 'reproduced' || github.event.label.name == 'under review'
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: |
export LABEL="JDBC"
if [ "$MIRROR_ISSUE_NUMBER" == "" ]; then
gh issue create --repo duckdblabs/duckdb-internal --label "$LABEL" --title "$TITLE_PREFIX - $PUBLIC_ISSUE_TITLE" --body "See https://github.com/duckdb/duckdb-java/issues/${{ github.event.issue.number }}"
fi
48 changes: 48 additions & 0 deletions .github/workflows/InternalIssuesUpdateMirror.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Update Mirror Issue
on:
issues:
types:
- closed
- reopened

env:
GH_TOKEN: ${{ secrets.DUCKDBLABS_BOT_TOKEN }}
TITLE_PREFIX: "[duckdb-java/#${{ github.event.issue.number }}]"

jobs:
update_mirror_issue:
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: Add comment with status to mirror issue
run: |
if [ "$MIRROR_ISSUE_NUMBER" != "" ]; then
gh issue comment --repo duckdblabs/duckdb-internal $MIRROR_ISSUE_NUMBER --body "The issue has been ${{ github.event.action }} (https://github.com/duckdb/duckdb-java/issues/${{ github.event.issue.number }})."
fi
- name: Add closed label to mirror issue
if: github.event.action == 'closed'
run: |
if [ "$MIRROR_ISSUE_NUMBER" != "" ]; then
gh issue edit --repo duckdblabs/duckdb-internal $MIRROR_ISSUE_NUMBER --add-label "public closed" --remove-label "public reopened"
fi
- name: Reopen mirror issue and add reopened label
if: github.event.action == 'reopened'
run: |
if [ "$MIRROR_ISSUE_NUMBER" != "" ]; then
gh issue reopen --repo duckdblabs/duckdb-internal $MIRROR_ISSUE_NUMBER
gh issue edit --repo duckdblabs/duckdb-internal $MIRROR_ISSUE_NUMBER --add-label "public reopened" --remove-label "public closed"
fi

0 comments on commit 32528f5

Please sign in to comment.