Skip to content

Pull Request Reviewed Workflow #330

Pull Request Reviewed Workflow

Pull Request Reviewed Workflow #330

---
name: "Pull Request Reviewed Workflow"
# Privileged half of the review relay (see README.md): reads the artifact
# uploaded by pr-reviewed.yaml and adds waiting-response (reviewer requested
# changes) or removes it (the author responded).
on:
workflow_run:
workflows:
- "Pull Request Reviewed"
types:
- completed
permissions:
pull-requests: write
jobs:
add-or-remove-waiting-response:
runs-on: ubuntu-latest
outputs:
ghrepo: ${{ steps.env_vars.outputs.ghrepo }}
ghowner: ${{ steps.env_vars.outputs.ghowner }}
prnumber: ${{ steps.env_vars.outputs.prnumber }}
action: ${{ steps.env_vars.outputs.action }}
artifact_outcome: ${{ steps.env_vars.outputs.artifact_outcome }}
steps:
- name: Get Artifact
id: get_artifact
continue-on-error: true
uses: dawidd6/action-download-artifact@b6e2e70617bc3265edd6dab6c906732b2f1ae151 # v21
with:
github_token: ${{secrets.GITHUB_TOKEN}}
run_id: ${{ github.event.workflow_run.id }}
- name: env_vars
id: env_vars
if: steps.get_artifact.outcome == 'success'
run: |
echo "ghrepo=$(cat artifact/ghrepo.txt)" >>${GITHUB_OUTPUT}
echo "ghowner=$(cat artifact/ghowner.txt)" >>${GITHUB_OUTPUT}
echo "prnumber=$(cat artifact/prnumber.txt)" >>${GITHUB_OUTPUT}
echo "action=$(cat artifact/action.txt)" >>${GITHUB_OUTPUT}
echo "artifact_outcome=success" >>${GITHUB_OUTPUT}
add-waiting-reponse:
needs: add-or-remove-waiting-response
runs-on: ubuntu-latest
if: needs.add-or-remove-waiting-response.outputs.artifact_outcome == 'success' && needs.add-or-remove-waiting-response.outputs.action == 'add-waiting-response'
steps:
- run: |
curl -X POST -H "Accept: application/vnd.github+json" -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/repos${{ needs.add-or-remove-waiting-response.outputs.ghowner }}/${{ needs.add-or-remove-waiting-response.outputs.ghrepo }}/issues/${{ needs.add-or-remove-waiting-response.outputs.prnumber }}/labels" -d '{"labels":["waiting-response"]}'
remove-waiting-reponse:

Check failure on line 54 in .github/workflows/pr-waiting-response-on-review.yaml

View workflow run for this annotation

GitHub Actions / Pull Request Reviewed Workflow

Invalid workflow file

The workflow is not valid. .github/workflows/pr-waiting-response-on-review.yaml (Line: 54, Col: 3): Error calling workflow 'hashicorp/terraform-provider-azurerm/.github/workflows/issue-remove-label.yaml@a4b20e7d6fcf9f9f05496aaa65bbcdbbe69aae37'. The workflow is requesting 'issues: write', but is only allowed 'issues: none'.
needs: add-or-remove-waiting-response
if: needs.add-or-remove-waiting-response.outputs.artifact_outcome == 'success' && needs.add-or-remove-waiting-response.outputs.action == 'remove-waiting-response'
uses: ./.github/workflows/issue-remove-label.yaml
with:
label-name: "waiting-response"