Skip to content

Liveness

Liveness #533

# Description: This workflow automatically adds a `pending-triage` label to issues that need attention
#
# Triggered by: newly opened, re-opened or transferred issues
name: Mark Issues for Triage
on:
issues:
types: [opened, reopened, transferred]
jobs:
label_issues:
runs-on: ubuntu-latest
permissions:
issues: write
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ISSUE_NUMBER: ${{ github.event.issue.number }}
REPOSITORY_NAME: ${{ github.event.repository.full_name }}
steps:
- uses: actions/checkout@b80ff79f1755d06ba70441c368a6fe801f5f3a62 # v4.1.3 https:/actions/checkout/commit/cd7d8d697e10461458bc61a30d094dc601a8b017
- name: Add pending-triage label
shell: bash
# run bash script to sanitize issue number and add label
# first sanitize the ISSUE_NUMBER which is a assumed to be string representing an integer
# remove any newline characters with tr because awk only works with single lines of code and may have unexpected behavior if newline is present
# awk applies the int function to the input, converting it to an integer
# finally check if the resulting value, assigned to ISSUE_NUMBER_INT is positive
run: |
ISSUE_NUMBER_INT=$(echo "$ISSUE_NUMBER" | tr -d '\n' | awk '{print int($0)}')
if [ "$ISSUE_NUMBER_INT" -le 0 ]; then
echo "Issue number must be a positive integer"
exit 1
fi
gh issue edit $ISSUE_NUMBER_INT --repo $REPOSITORY_NAME --add-label 'pending-triage'
- name: Add pending-maintainer-response label
if: ${{ !contains(fromJSON('["MEMBER", "OWNER"]'), github.event.issue.author_association) }}
shell: bash
run: |
ISSUE_NUMBER_INT=$(echo "$ISSUE_NUMBER" | tr -d '\n' | awk '{print int($0)}')
if [ "$ISSUE_NUMBER_INT" -le 0 ]; then
echo "Issue number must be a positive integer"
exit 1
fi
gh issue edit $ISSUE_NUMBER_INT --repo $REPOSITORY_NAME --add-label "pending-maintainer-response"