feat: Add related tools and setups to the gaming tab #283
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: Label PR | |
| on: | |
| pull_request: | |
| types: [opened] | |
| jobs: | |
| labelPR: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| issues: write | |
| pull-requests: write | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Extract referenced issues | |
| run: | | |
| BODY="${{ github.event.pull_request.body }}" | |
| ISSUES=$(echo "$BODY" | grep -Eio '(Fixes|Resolves|Closes):? #[0-9]+' | grep -Eo '[0-9]+' | uniq) | |
| echo "ISSUES=$ISSUES" >> $GITHUB_ENV | |
| - name: Get issue labels | |
| if: env.ISSUES != '' | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| LABELS="" | |
| for ISSUE in ${{ env.ISSUES }}; do | |
| ISSUE_LABELS=$(gh api "/repos/${{ github.repository }}/issues/$ISSUE" \ | |
| --jq '.labels[].name | select(contains(":"))') | |
| if [[ -n "$ISSUE_LABELS" ]]; then | |
| if [[ -z "$LABELS" ]]; then | |
| LABELS="$ISSUE_LABELS" | |
| else | |
| LABELS="$LABELS"$'\n'"$ISSUE_LABELS" | |
| fi | |
| fi | |
| done | |
| if [[ -n "$LABELS" ]]; then | |
| UNIQUE_LABELS=$(echo "$LABELS" | sort -u | tr '\n' ',' | sed 's/,$//') | |
| echo "LABELS=$UNIQUE_LABELS" >> $GITHUB_ENV | |
| else | |
| echo "LABELS=" >> $GITHUB_ENV | |
| fi | |
| - name: Assign labels | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| gh pr edit ${{ github.event.pull_request.number }} --add-label "initial review required" | |
| if [[ -n "${{ env.LABELS }}" ]]; then | |
| IFS=',' read -ra LABEL_ARRAY <<< "${{ env.LABELS }}" | |
| for label in "${LABEL_ARRAY[@]}"; do | |
| gh pr edit ${{ github.event.pull_request.number }} --add-label "$label" | |
| done | |
| fi |