From 8e7bc1bb6ebe3b48fba9582f58985e8709308658 Mon Sep 17 00:00:00 2001 From: Gabor Szarnyas Date: Thu, 25 Sep 2025 22:24:18 +0200 Subject: [PATCH 1/2] CI: Add jobs to mirror issues --- .../workflows/InternalIssuesCreateMirror.yml | 82 +++++++++++++++++++ .../workflows/InternalIssuesUpdateMirror.yml | 51 ++++++++++++ 2 files changed, 133 insertions(+) create mode 100644 .github/workflows/InternalIssuesCreateMirror.yml create mode 100644 .github/workflows/InternalIssuesUpdateMirror.yml diff --git a/.github/workflows/InternalIssuesCreateMirror.yml b/.github/workflows/InternalIssuesCreateMirror.yml new file mode 100644 index 00000000..e0313e11 --- /dev/null +++ b/.github/workflows/InternalIssuesCreateMirror.yml @@ -0,0 +1,82 @@ +name: Create or Label Mirror Issue +on: + discussion: + types: + - labeled + issues: + types: + - labeled + +env: + GH_TOKEN: ${{ secrets.DUCKDBLABS_BOT_TOKEN }} + TITLE_PREFIX: "[duckdb-python/#${{ github.event.issue.number || github.event.discussion.number }}]" + PUBLIC_ISSUE_TITLE: ${{ github.event.issue.title }} + +jobs: + add_needs_reproducible_example_comment: + if: github.event.label.name == 'needs reproducible example' + runs-on: ubuntu-latest + steps: + - name: Add comment + run: | + cat > needs-reproducible-example-comment.md << EOF + Thanks for opening this issue in the DuckDB-Python project's issue tracker! To resolve this issue, our team needs a reproducible example. This includes: + + * A source code snippet which reproduces the issue. + * The snippet should be self-contained, i.e., it should contain all imports and should use relative paths instead of hard coded paths (please avoid \`/Users/JohnDoe/...\`). + * A lot of issues can be reproduced with plain SQL code executed in the [DuckDB command line client](https://duckdb.org/docs/api/cli/overview). For such issues, please open an issue in the [main DuckDB repository](https://github.com/duckdb/duckdb/). + * If the script needs additional data, please share the data as a CSV, JSON, or Parquet file. Unfortunately, we cannot fix issues that can only be reproduced with a confidential data set. [Support contracts](https://duckdblabs.com/#support) allow sharing confidential data with the core DuckDB team under NDA. + + For more detailed guidelines on how to create reproducible examples, please visit Stack Overflow's [“Minimal, Reproducible Example”](https://stackoverflow.com/help/minimal-reproducible-example) page. + EOF + gh issue comment --repo duckdb/duckdb-python ${{ github.event.issue.number || github.event.discussion.number }} --body-file needs-reproducible-example-comment.md + + create_or_label_mirror_issue: + if: github.event.label.name == 'reproduced' || github.event.label.name == 'under review' + 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-python ${{ github.event.issue.number || github.event.discussion.number }} --remove-label "needs triage" --remove-label "under review" --remove-label "needs reproducible example" + + - name: Remove 'needs triage' / 'reproduced' if 'under review' + if: github.event.label.name == 'under review' + run: | + gh issue edit --repo duckdb/duckdb-python ${{ github.event.issue.number || github.event.discussion.number }} --remove-label "needs triage" --remove-label "reproduced" + + - name: Remove 'needs triage' if 'expected behavior' + if: github.event.label.name == 'expected behavior' + run: | + gh issue edit --repo duckdb/duckdb-python ${{ github.event.issue.number || github.event.discussion.number }} --remove-label "needs triage" + + - 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: Set label environment variable + run: | + if ${{ github.event.label.name == 'reproduced' }}; then + echo "LABEL=reproduced" >> $GITHUB_ENV + echo "UNLABEL=under review" >> $GITHUB_ENV + else + echo "LABEL=under review" >> $GITHUB_ENV + echo "UNLABEL=reproduced" >> $GITHUB_ENV + fi + + - name: Create or label issue + run: | + if [ "$MIRROR_ISSUE_NUMBER" == "" ]; then + gh issue create --repo duckdblabs/duckdb-internal --label "$LABEL" --label "Python" --title "$TITLE_PREFIX - $PUBLIC_ISSUE_TITLE" --body "See https://github.com/duckdb/duckdb-python/issues/${{ github.event.issue.number || github.event.discussion.number }}" + else + gh issue edit --repo duckdblabs/duckdb-internal $MIRROR_ISSUE_NUMBER --remove-label "$UNLABEL" --add-label "$LABEL" + fi diff --git a/.github/workflows/InternalIssuesUpdateMirror.yml b/.github/workflows/InternalIssuesUpdateMirror.yml new file mode 100644 index 00000000..2a50647d --- /dev/null +++ b/.github/workflows/InternalIssuesUpdateMirror.yml @@ -0,0 +1,51 @@ +name: Update Mirror Issue +on: + discussion: + types: + - labeled + issues: + types: + - closed + - reopened + +env: + GH_TOKEN: ${{ secrets.DUCKDBLABS_BOT_TOKEN }} + TITLE_PREFIX: "[ducklake/#${{ github.event.issue.number || github.event.discussion.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/ducklake/issues/${{ github.event.issue.number || github.event.discussion.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 From 2eb83cad2e421c295d34bfea58458a4ee7836461 Mon Sep 17 00:00:00 2001 From: Gabor Szarnyas Date: Fri, 26 Sep 2025 15:54:11 +0200 Subject: [PATCH 2/2] CI: Fix repository name --- .github/workflows/InternalIssuesUpdateMirror.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/InternalIssuesUpdateMirror.yml b/.github/workflows/InternalIssuesUpdateMirror.yml index 2a50647d..20d16d39 100644 --- a/.github/workflows/InternalIssuesUpdateMirror.yml +++ b/.github/workflows/InternalIssuesUpdateMirror.yml @@ -10,7 +10,7 @@ on: env: GH_TOKEN: ${{ secrets.DUCKDBLABS_BOT_TOKEN }} - TITLE_PREFIX: "[ducklake/#${{ github.event.issue.number || github.event.discussion.number }}]" + TITLE_PREFIX: "[duckdb-python/#${{ github.event.issue.number || github.event.discussion.number }}]" jobs: update_mirror_issue: @@ -32,7 +32,7 @@ jobs: - 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/ducklake/issues/${{ github.event.issue.number || github.event.discussion.number }})." + gh issue comment --repo duckdblabs/duckdb-internal $MIRROR_ISSUE_NUMBER --body "The issue has been ${{ github.event.action }} (https://github.com/duckdb/duckdb-python/issues/${{ github.event.issue.number || github.event.discussion.number }})." fi - name: Add closed label to mirror issue