Add "approved" label when approved #5
This file contains 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: Add "approved" label when approved | |
on: | |
pull_request_review: | |
types: | |
- submitted | |
jobs: | |
add_label: | |
name: Add "approved" label when approved | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 # Make sure to use the latest version | |
- name: Check for approval | |
id: check_approval | |
run: echo "::set-output name=approved::${{ github.event.review.state == 'approved' }}" | |
- name: Add "approved" label | |
if: steps.check_approval.outputs.approved == 'true' | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
echo "Adding 'approved' label" | |
cd $GITHUB_WORKSPACE # Set the working directory to the root of the repository | |
gh pr edit ${{ github.event.pull_request.number }} --add-label approved |