My Story #6
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: Approval Tracking | |
on: | |
issue_comment: | |
types: [created] | |
jobs: | |
approval: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check for approval comment | |
if: contains(github.event.comment.body, '/approve') | |
run: | | |
ISSUE_NUMBER=${{ github.event.issue.number }} | |
APPROVER=${{ github.actor }} | |
# Add approval label based on the approver | |
if [[ "$APPROVER" == "product-owner-username" ]]; then | |
LABEL="Product Owner Approved" | |
elif [[ "$APPROVER" == "developer-username" ]]; then | |
LABEL="Developer Approved" | |
elif [[ "$APPROVER" == "qa-username" ]]; then | |
LABEL="QA Approved" | |
fi | |
# Add the appropriate label | |
curl -L \ | |
-X POST \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/labels \ | |
-d '{"labels":["Product Owner Approved"]}' |