From 09bdb5b9d4e9df9019f172a0e3e8fc19f568446c Mon Sep 17 00:00:00 2001 From: Gabor Szarnyas Date: Sat, 4 Nov 2023 17:23:58 +0100 Subject: [PATCH] CI: Add workflow file for labelling issues as 'High Priority' --- .github/workflows/HighPriorityIssues.yml | 36 ++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/HighPriorityIssues.yml diff --git a/.github/workflows/HighPriorityIssues.yml b/.github/workflows/HighPriorityIssues.yml new file mode 100644 index 00000000..1f4dbb0f --- /dev/null +++ b/.github/workflows/HighPriorityIssues.yml @@ -0,0 +1,36 @@ +name: Create Internal issue when the "High Priority" label is applied +on: + issues: + types: + - labeled + +env: + GH_TOKEN: ${{ secrets.DUCKDBLABS_BOT_TOKEN }} + # an event triggering this workflow is either an issue or a pull request, + # hence only one of the numbers will be filled in the TITLE_PREFIX + TITLE_PREFIX: "[duckdb-rs/#${{ github.event.issue.number }}]" + PUBLIC_ISSUE_TITLE: ${{ github.event.issue.title }} + +jobs: + create_or_label_issue: + if: github.event.label.name == 'High Priority' + runs-on: ubuntu-latest + steps: + - name: Get mirror issue number + run: | + gh issue list --repo duckdblabs/duckdb-internal --search "${TITLE_PREFIX}" --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: Create or label issue + run: | + if [ "$MIRROR_ISSUE_NUMBER" == "" ]; then + gh issue create --repo duckdblabs/duckdb-internal --label "Rust" --label "High Priority" --title "$TITLE_PREFIX - $PUBLIC_ISSUE_TITLE" --body "See https://github.com/duckdb/duckdb/issues/${{ github.event.issue.number }}" + fi