From 19d2fba333bc36bbe560d38c3e7365f37c82c399 Mon Sep 17 00:00:00 2001 From: Anirudh Oppiliappan Date: Thu, 3 Mar 2022 15:32:00 +0530 Subject: [PATCH] feat: filter issues to migrate by milestone (#15) --- .github/workflows/migrate-to-project.yaml | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/.github/workflows/migrate-to-project.yaml b/.github/workflows/migrate-to-project.yaml index 362016b..00b3183 100644 --- a/.github/workflows/migrate-to-project.yaml +++ b/.github/workflows/migrate-to-project.yaml @@ -16,6 +16,9 @@ on: description: Name of the 'Todo' status on the project board required: false default: "Needs Triage" + milestone: + description: Name of the Milestone to filter by + required: false env: GITHUB_TOKEN: ${{ secrets.PLANNING_AUTOMATION_TOKEN }} @@ -59,6 +62,10 @@ jobs: edges { node { id + milestone { + id + title + } } } } @@ -66,17 +73,29 @@ jobs: edges { node { id + milestone { + id + title + } } } } } }' -f org="$org" -f repo="$repo" > data.json - - name: Extract issue/PR IDs and migrate + - env: + MILESTONE: ${{ inputs.milestone }} + name: Extract issue/PR IDs and migrate run: | + if [[ "$MILESTONE" != "" ]]; then + ISSUE_IDS=($(jq -r '.data.repository.issues.edges[].node | select(.milestone.title == ${{ env.MILESTONE }}).id' -c data.json)) + PR_IDS=($(jq -r '.data.repository.prs.edges[].node | select(.milestone.title == ${{ env.MILESTONE }}).id' -c data.json)) + fi ISSUE_IDS=($(jq .data.repository.issues.edges[].node.id -c data.json)) PR_IDS=($(jq .data.repository.prs.edges[].node.id -c data.json)) + + migrate() { ISSUE_PR_ID="$1"