Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions .github/workflows/flag-solicitation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,24 @@ jobs:
env:
BODY: ${{ github.event.comment.body }}
run: |
# Word currencies need a word boundary so "errors 2" and "hours 5" do not hit.
# Word currencies need a word boundary so "errors 2" and "hours 5" do not hit. "rs" needs a
# space or dot before the amount (not "RS256"), and a lone "$1" is a shell reference, not money.
# A currency amount, or a phrase that only makes sense as an offer of paid work.
# Deliberately excludes bare "quote" and "estimate": both are ordinary words in a
# technical thread ("quote the exact error", "your estimate for the timeline"), and
# labelling a volunteer's comment as solicitation is worse than missing one.
if printf '%s' "$BODY" | grep -qiE '(\$|£|₱|\b(usd|eur|inr|rs\.?))[[:space:]]*[0-9]|[0-9]+[[:space:]]*(usd|eur|dollars)|\b(my rate|for a fee|paid work|hire me|i can do this for|send payment|paypal|western union)\b'; then
if printf '%s' "$BODY" | grep -qiE '(\$[[:space:]]*([0-9]{2,}|[0-9][.,][0-9])|£[[:space:]]*[0-9]|₱[[:space:]]*[0-9]|\b(usd|eur|inr)[[:space:]]*\$?[0-9]|\brs(\.[[:space:]]*|[[:space:]]+)[0-9])|[0-9]+[[:space:]]*(usd|eur|dollars)|\b(my rate|for a fee|paid work|hire me|i can do this for|send payment|paypal|western union)\b'; then
echo "hit=true" >> "$GITHUB_OUTPUT"
else
echo "hit=false" >> "$GITHUB_OUTPUT"
fi

- name: Label and notify
if: steps.scan.outputs.hit == 'true' && github.event.comment.user.login != github.repository_owner
# repository_owner is the org name on org repos, so also skip people with a role on the repo.
if: >-
steps.scan.outputs.hit == 'true' &&
github.event.comment.user.login != github.repository_owner &&
!contains(fromJSON('["OWNER","MEMBER","COLLABORATOR"]'), github.event.comment.author_association)
env:
GH_TOKEN: ${{ github.token }}
REPO: ${{ github.repository }}
Expand Down
Loading