88 env :
99 BODY : ${{ github.event.issue.body }}
1010 TITLE : ${{ github.event.issue.title }}
11+ REPOSITORY : ${{ github.repository }}
12+ ISSUE_NUMBER : ${{ github.event.issue.number }}
1113 steps :
1214 - name : Checkout code
1315 uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
3436 if : ${{ env.TITLE_CHECK_FAILED != 'true' }}
3537 run : |
3638 comments=$(curl -s -H "Authorization: token ${{ secrets.TWOMS_BOT_PAT}}" \
37- -X GET "https://api.github.com/repos/${{ github.repository }} /issues/${{ github.event.issue.number }} /comments")
39+ -X GET "https://api.github.com/repos/$REPOSITORY /issues/$ISSUE_NUMBER /comments")
3840 if echo "$comments" | grep -q "title_check"; then
3941 echo "TAG_EXISTS=true" >> $GITHUB_ENV
4042 else
6769 BODY : ${{ github.event.issue.body }}
6870 LABELS : ${{ toJson(github.event.issue.labels) }}
6971 TITLE : ${{ github.event.issue.title }}
72+ REPOSITORY : ${{ github.repository }}
73+ ISSUE_NUMBER : ${{ github.event.issue.number }}
7074 steps :
7175 - name : Checkout code
7276 uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
@@ -82,39 +86,39 @@ jobs:
8286 if [[ "$TITLE" == feat* ]] || echo "$TITLE $BODY" | grep -iqP "feature request" || echo "$BODY" | grep -iqP "Is your feature request related to a problem? Please describe." || echo "$BODY" | grep -iqP "Describe the solution you'd like" || echo "$BODY" | grep -iqP "Describe alternatives you've considered" || echo "$BODY" | grep -iqP "Additional context"; then
8387 if [[ "$IS_MEMBER" == "true" ]]; then
8488 echo "Adding 'feature' label..."
85- curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -X POST -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/${{ github.repository }} /issues/${{ github.event.issue.number }} /labels -d '{"labels": ["feature"]}'
89+ curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -X POST -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/$REPOSITORY /issues/$ISSUE_NUMBER /labels -d '{"labels": ["feature"]}'
8690 else
8791 echo "Adding 'feature request' label..."
88- curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -X POST -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/${{ github.repository }} /issues/${{ github.event.issue.number }} /labels -d '{"labels": ["feature request"]}'
92+ curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -X POST -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/$REPOSITORY /issues/$ISSUE_NUMBER /labels -d '{"labels": ["feature request"]}'
8993 fi
9094 else
9195 if echo "$LABELS" | grep -q "feature request"; then
9296 echo "Removing 'feature request' label..."
93- curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -X DELETE -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/${{ github.repository }} /issues/${{ github.event.issue.number }} /labels/feature%20request
97+ curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -X DELETE -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/$REPOSITORY /issues/$ISSUE_NUMBER /labels/feature%20request
9498 elif echo "$LABELS" | grep -q "feature"; then
9599 echo "Removing 'feature' label..."
96- curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -X DELETE -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/${{ github.repository }} /issues/${{ github.event.issue.number }} /labels/feature
100+ curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -X DELETE -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/$REPOSITORY /issues/$ISSUE_NUMBER /labels/feature
97101 fi
98102 fi
99103 - name : Add bug label
100104 run : |
101105 if echo "$TITLE $BODY" | grep -iqP "(\\b|_)bugs?(\\b|_)" || echo "$BODY" | grep -iqP "steps to reproduce" || echo "$BODY" | grep -iqP "actual behavior" || echo "$BODY" | grep -iqP "expected behavior"; then
102106 echo "Adding 'bug' label..."
103- curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -X POST -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/${{ github.repository }} /issues/${{ github.event.issue.number }} /labels -d '{"labels": ["bug"]}'
107+ curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -X POST -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/$REPOSITORY /issues/$ISSUE_NUMBER /labels -d '{"labels": ["bug"]}'
104108 else
105109 if echo "$LABELS" | grep -q "bug"; then
106110 echo "Removing 'bug' label..."
107- curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -X DELETE -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/${{ github.repository }} /issues/${{ github.event.issue.number }} /labels/bug
111+ curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -X DELETE -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/$REPOSITORY /issues/$ISSUE_NUMBER /labels/bug
108112 fi
109113 fi
110114 - name : Add bug label (extra)
111115 run : |
112116 if echo "$TITLE $BODY" | grep -iqP "(\\b|_)bugs?(\\b|_)" || echo "$BODY" | grep -iqP "steps to reproduce" || echo "$BODY" | grep -iqP "actual behavior" || echo "$BODY" | grep -iqP "expected behavior"; then
113117 echo "Adding 'bug' label (extra)..."
114- curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -X POST -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/${{ github.repository }} /issues/${{ github.event.issue.number }} /labels -d '{"labels": ["bug"]}'
118+ curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -X POST -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/$REPOSITORY /issues/$ISSUE_NUMBER /labels -d '{"labels": ["bug"]}'
115119 else
116120 if echo "$LABELS" | grep -q "bug"; then
117121 echo "Removing 'bug' label (extra)..."
118- curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -X DELETE -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/${{ github.repository }} /issues/${{ github.event.issue.number }} /labels/bug
122+ curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -X DELETE -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/$REPOSITORY /issues/$ISSUE_NUMBER /labels/bug
119123 fi
120124 fi
0 commit comments