Skip to content

Commit

Permalink
test tool cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
sqin2019 committed Jul 26, 2023
1 parent 30d23b6 commit 48b8f87
Showing 1 changed file with 27 additions and 27 deletions.
54 changes: 27 additions & 27 deletions .github/workflows/tool_cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit 48b8f87

Please sign in to comment.