Skip to content

[Sky Island] Add merchant stall upgrade #3703

[Sky Island] Add merchant stall upgrade

[Sky Island] Add merchant stall upgrade #3703

name: Greet new commenters
on:
issue_comment:
types:
- created
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.issue.number }}
jobs:
triage:
permissions:
pull-requests: write
if: ${{ github.event.issue.pull_request }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check if user has any existing PR comments in this repository
id: pr-comment-check
run: |
commenter="${{ github.event.comment.user.login }}"
echo "Debug: Checking comment counts for... $commenter"
comment_count_all_PR=$(gh search prs --repo=CleverRaven/Cataclysm-DDA --commenter $commenter --json id | jq 'length')
num_PRs_authored=$(gh search prs --repo=CleverRaven/Cataclysm-DDA --author $commenter --json id | jq 'length')
num_times_commented=$(gh pr view $PR_NUMBER --json comments --jq "[.comments.[].author.login | match(\"$commenter\")] | length")
echo "Debug: $commenter with $comment_count_all_PR PRs commented on, including checked comment. PR contains $num_times_commented comments from them. They have authored $num_PRs_authored PRs in CleverRaven."
echo "comment_count_all_PR=$comment_count_all_PR" >> $GITHUB_OUTPUT
echo "num_times_commented=$num_times_commented" >> $GITHUB_OUTPUT
echo "num_PRs_authored=$num_PRs_authored" >> $GITHUB_OUTPUT
- name: Greet commenters with no previous comments
if: steps.pr-comment-check.outputs.comment_count_all_PR == 1 && steps.pr-comment-check.outputs.num_times_commented == 1 && steps.pr-comment-check.outputs.num_PRs_authored == 0
run: |
# I have no earthly idea how to pass the commenter on from the previous run (I have tried), so let's just re-acquire it.
commenter_name="${{ github.event.comment.user.login }}"
# We 'hardcode' the URLs here because doing a dynamic url points to OWNER/REPO/pull/code_of_conduct.md. Why is the 'pull' there? No idea.
gh pr comment $PR_NUMBER --body "Hi @$commenter_name, welcome to CleverRaven! We see that this is your first time commenting here. Check out [how development works](https://github.com/CleverRaven/Cataclysm-DDA/blob/master/doc/development_process.md) and be sure to follow the [code of conduct](https://github.com/CleverRaven/Cataclysm-DDA/blob/master/CODE_OF_CONDUCT.md)! We hope to see you around!"