Skip to content

Commit ff01285

Browse files
authored
meta(gha): Deploy action validate-new-issue.yml (#883)
1 parent 7365a03 commit ff01285

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

.github/workflows/validate-new-issue.yml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@ jobs:
2323
echo "${{ github.actor }} is not a member of the getsentry org. 🧐"
2424
fi
2525
26+
# Helper
27+
function gh-issue-label() {
28+
gh api "/repos/:owner/:repo/issues/${1}/labels" \
29+
-X POST \
30+
--input <(echo "{\"labels\":[\"$2\"]}")
31+
}
32+
2633
# Prep reasons for error message comment.
2734
REASON="your issue does not properly use one of this repo's available issue templates"
2835
REASON_EXACT_MATCH="you created an issue from a template without filling in anything"
@@ -66,9 +73,7 @@ jobs:
6673
REASON="${REASON_EXACT_MATCH}"
6774
break
6875
else
69-
gh api "/repos/:owner/:repo/issues/${issue_number}/labels" \
70-
-X POST \
71-
--input <(echo '{"labels":["Status: Unrouted"]}')
76+
gh-issue-label "${issue_number}" "Status: Unrouted"
7277
exit 0
7378
fi
7479
else
@@ -77,7 +82,7 @@ jobs:
7782
done
7883
fi
7984
80-
# Failed validation! Close the issue with a comment.
85+
# Failed validation! Close the issue with a comment and a label.
8186
cat << EOF > comment
8287
Sorry, friend. As far as this ol' bot can tell, ${REASON}. Please [try again](https://github.com/${{ github.repository }}/issues/new/choose), if you like. (And if I'm confused, please [let us know](https://github.com/getsentry/.github/issues/new?title=$(echo "$BASE_CASE_TITLE" | tr ' ' '+')&body=${{ github.event.issue.html_url }}). 😬)
8388
@@ -89,6 +94,7 @@ jobs:
8994
EOF
9095
9196
echo -n "Commented: "
92-
gh issue comment ${{ github.event.issue.number }} --body "$(cat comment)"
93-
gh issue close ${{ github.event.issue.number }}
97+
gh issue comment "${issue_number}" --body "$(cat comment)"
98+
gh-issue-label "${issue_number}" "Status: Invalid"
99+
gh issue close "${issue_number}"
94100
echo "Closed with: \"${REASON}.\""

0 commit comments

Comments
 (0)