-
Notifications
You must be signed in to change notification settings - Fork 8
43 lines (38 loc) · 1.68 KB
/
MirrorInternally.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
name: Create or Label Mirror Issue
on:
issues:
types:
- opened
- edited
env:
GH_TOKEN: ${{ secrets.DUCKDBLABS_BOT_TOKEN }}
TITLE_PREFIX: "[odbc/#${{ github.event.issue.number }}]"
PUBLIC_ISSUE_TITLE: ${{ github.event.issue.title }}
jobs:
create_or_label_issue:
runs-on: ubuntu-latest
steps:
- name: Get mirror issue number
run: |
gh issue list --repo duckdblabs/duckdb-odbc-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.created }}; then
echo "LABEL=new issue" >> $GITHUB_ENV
else
echo "LABEL=updated" >> $GITHUB_ENV
- name: Create or Label Mirror Issue
run: |
if [ "$MIRROR_ISSUE_NUMBER" == "" ]; then
gh issue create --repo duckdblabs/duckdb-odbc-internal --title "$TITLE_PREFIX - $PUBLIC_ISSUE_TITLE" --body "See https://github.com/duckdb/duckdb-odbc/issues/${{ github.event.issue.number }}" --label "$LABEL"
else
gh issue edit --repo duckdblabs/duckdb-odbc-internal $MIRROR_ISSUE_NUMBER --title "$PUBLIC_ISSUE_TITLE" --label "$LABEL"
fi