From 48b8f87cef0b4be9b06df15d0105ef80552a14ff Mon Sep 17 00:00:00 2001 From: Suhong Qin Date: Wed, 26 Jul 2023 15:58:55 -0700 Subject: [PATCH] test tool cleanup --- .github/workflows/tool_cleanup.yml | 54 +++++++++++++++--------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/.github/workflows/tool_cleanup.yml b/.github/workflows/tool_cleanup.yml index d82c849..f3533b1 100644 --- a/.github/workflows/tool_cleanup.yml +++ b/.github/workflows/tool_cleanup.yml @@ -42,36 +42,36 @@ env: jobs: # Check the current status of this pull request with respect to code review. - # review_status: - # runs-on: 'ubuntu-latest' - # permissions: - # pull-requests: 'read' - # outputs: - # REVIEW_DECISION: '${{ steps.get_review_decision.outputs.REVIEW_DECISION }}' - # steps: - # - id: 'get_review_decision' - # env: - # # Set the GH_TOKEN environment variable to use GitHub CLI in a GitHub Actions workflow. - # # See ref: https://docs.github.com/en/actions/using-workflows/using-github-cli-in-workflows - # GH_TOKEN: '${{ github.token }}' - # run: | - # repo=${{ github.repository }} - # reviewDecision="$(gh api graphql -F owner=${{ github.repository_owner }} -F name=${repo##*/} -F pr_number=${{ github.event.pull_request.number }} -f query=' - # query($name: String!, $owner: String!, $pr_number: Int!) { - # repository(owner: $owner, name: $name) { - # pullRequest(number: $pr_number) { - # reviewDecision - # } - # } - # } - # ' --jq '.data.repository.pullRequest.reviewDecision')" - - # echo REVIEW_DECISION=$reviewDecision >> $GITHUB_OUTPUT + review_status: + runs-on: 'ubuntu-latest' + permissions: + pull-requests: 'read' + outputs: + REVIEW_DECISION: '${{ steps.get_review_decision.outputs.REVIEW_DECISION }}' + steps: + - id: 'get_review_decision' + env: + # Set the GH_TOKEN environment variable to use GitHub CLI in a GitHub Actions workflow. + # See ref: https://docs.github.com/en/actions/using-workflows/using-github-cli-in-workflows + GH_TOKEN: '${{ github.token }}' + run: | + repo=${{ github.repository }} + reviewDecision="$(gh api graphql -F owner=${{ github.repository_owner }} -F name=${repo##*/} -F pr_number=${{ github.event.pull_request.number }} -f query=' + query($name: String!, $owner: String!, $pr_number: Int!) { + repository(owner: $owner, name: $name) { + pullRequest(number: $pr_number) { + reviewDecision + } + } + } + ' --jq '.data.repository.pullRequest.reviewDecision')" + + echo REVIEW_DECISION=$reviewDecision >> $GITHUB_OUTPUT # Only run Tool request cleanup when the pull request is approved. cleanup: - # needs: 'review_status' - # if: '${{ needs.review_status.outputs.REVIEW_DECISION == ''APPROVED'' }}' + needs: 'review_status' + if: '${{ needs.review_status.outputs.REVIEW_DECISION == ''APPROVED'' }}' runs-on: 'ubuntu-latest' permissions: contents: 'read'