From f9be78e493f38b4fcdcf6616331daec52d3501e9 Mon Sep 17 00:00:00 2001 From: Sarah Edwards Date: Fri, 26 Mar 2021 11:06:55 -0700 Subject: [PATCH] use gh cli instead of graphql api (#18429) --- .github/allowed-actions.js | 1 - .github/workflows/remove-from-fr-board.yaml | 61 ++++----------------- 2 files changed, 10 insertions(+), 52 deletions(-) diff --git a/.github/allowed-actions.js b/.github/allowed-actions.js index 2aaed21b79..23a12cebbe 100644 --- a/.github/allowed-actions.js +++ b/.github/allowed-actions.js @@ -27,7 +27,6 @@ module.exports = [ "juliangruber/find-pull-request-action@2fc55e82a6d5d36fe1e7f1848f7e64fd02d99de9", "juliangruber/read-file-action@e0a316da496006ffd19142f0fd594a1783f3b512", "lee-dohm/close-matching-issues@22002609b2555fe18f52b8e2e7c07cbf5529e8a8", - "octokit/graphql-action@5b3e01d42dee4509b0ac6b1cb2cf7778cdce85c2", "pascalgn/automerge-action@c9bd1823770819dc8fb8a5db2d11a3a95fbe9b07", //pascalgn/automerge@0.12.0 "peter-evans/create-issue-from-file@a04ce672e3acedb1f8e416b46716ddfd09905326", "peter-evans/create-or-update-comment@5221bf4aa615e5c6e95bb142f9673a9c791be2cd", diff --git a/.github/workflows/remove-from-fr-board.yaml b/.github/workflows/remove-from-fr-board.yaml index d25e87a2d3..bff1489448 100644 --- a/.github/workflows/remove-from-fr-board.yaml +++ b/.github/workflows/remove-from-fr-board.yaml @@ -13,56 +13,15 @@ jobs: if: github.repository == 'github/docs-internal' runs-on: ubuntu-latest steps: - - id: find_project_cards - uses: octokit/graphql-action@5b3e01d42dee4509b0ac6b1cb2cf7778cdce85c2 - with: - query: | - query($issue_node_id:ID!) { - node(id:$issue_node_id) { - ... on Issue { - projectCards(first: 10) { - nodes { - id - project { - name - id - } - } - } - } - ... on PullRequest { - projectCards(first: 10) { - nodes { - id - project { - name - id - } - } - } - } - } - } - issue_node_id: ${{ github.event.client_payload.command.resource.id }} + - name: Remove issue from board + if: ${{ github.event.client_payload.command.resource.type == 'Issue' }} + run: gh issue edit "$ISSUE_URL" --remove-project "Docs content first responder" env: - GITHUB_TOKEN: ${{ secrets.DOCUBOT_FR_PROJECT_BOARD_WORKFLOWS_REPO_ORG_READ_SCOPES }} - - - run: "echo 'Project cards found: ${{ steps.find_project_cards.outputs.data }}'" - - - name: Get FR card + GITHUB_TOKEN: ${{secrets.DOCUBOT_FR_PROJECT_BOARD_WORKFLOWS_REPO_ORG_READ_SCOPES}} + ISSUE_URL: https://github.com/${{ github.event.client_payload.command.repository.full_name }}/issues/${{ github.event.client_payload.command.resource.number }} + - name: Remove PR from board + if: ${{ github.event.client_payload.command.resource.type == 'PullRequest' }} + run: gh pr edit "$PR_URL" --remove-project "Docs content first responder" env: - QUERY_DATA: ${{ steps.find_project_cards.outputs.data }} - run: | - echo 'FR_CARDS='$(jq '.node.projectCards.nodes | .[] | select(.project.id == "MDc6UHJvamVjdDQ1NzI0ODI=") | .id' <<< "$QUERY_DATA") >> $GITHUB_ENV - - - name: Delete card - id: delete_project_card - if: ${{ env.FR_CARDS }} - uses: octokit/graphql-action@5b3e01d42dee4509b0ac6b1cb2cf7778cdce85c2 - with: - query: | - mutation DeleteCard { - deleteProjectCard(input:{cardId:${{ env.FR_CARDS }}}) {deletedCardId} - } - env: - GITHUB_TOKEN: ${{ secrets.DOCUBOT_FR_PROJECT_BOARD_WORKFLOWS_REPO_ORG_READ_SCOPES }} + GITHUB_TOKEN: ${{secrets.DOCUBOT_FR_PROJECT_BOARD_WORKFLOWS_REPO_ORG_READ_SCOPES}} + PR_URL: https://github.com/${{ github.event.client_payload.command.repository.full_name }}/pull/${{ github.event.client_payload.command.resource.number }}