diff --git a/.github/workflows/issue_comment.yml b/.github/workflows/issue_comment.yml index fa362fd..d7070c7 100644 --- a/.github/workflows/issue_comment.yml +++ b/.github/workflows/issue_comment.yml @@ -1,19 +1,25 @@ name: Auto-comment on new issues and pull requests -on: - issues: - types: [opened] - pull_request: - types: [opened] + +on: [pull_request_target, issues] jobs: - add-comment: + greeting: runs-on: ubuntu-latest - + permissions: + issues: write + pull-requests: write steps: - - name: Add comment for new issue or pull request - uses: actions-ecosystem/action-create-comment@v1 + - name: Set Condition + id: condition + run: | + if [[ "${{ github.event_name }}" == 'issues' ]]; then + echo "username=${{ github.event.issue.user.login }}" >> $GITHUB_ENV + else + echo "username=${{ github.event.pull_request.user.login }}" >> $GITHUB_ENV + fi + - name: Greet User + uses: actions/first-interaction@v1 with: - token: ${{ secrets.GITHUB_TOKEN }} - issue-number: ${{ github.event.issue.number || github.event.pull_request.number }} - body: | - ${{ github.event_name == 'issues' && 'Thank you @' || '' }}${{ github.event.issue.user.login || github.event.pull_request.user.login }}${{ github.event_name == 'issues' && ' for bringing up this issue to help enhance our project even further! We\'ll review it soon. 🙌❤️' || ' for opening a pull request. We\'ll review it as soon as possible 🙌❤️' }} + repo-token: ${{ secrets.GITHUB_TOKEN }} + issue-message: "Thank you @${{ env.username }} for bringing up this issue to help enhance our project even further! We'll review it soon. 🙌❤️" + pr-message: "Thank you for opening a pull request @${{ env.username }}. We'll review it as soon as possible 🙌❤️" \ No newline at end of file