Pull Request Reviewed Workflow #417
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | ||
| 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
|
||
| 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" | ||