diff --git a/.github/workflows/greetings.yml b/.github/workflows/greetings.yml index b115050af..81e539f95 100644 --- a/.github/workflows/greetings.yml +++ b/.github/workflows/greetings.yml @@ -1,14 +1,23 @@ -name: Greetings +name: 'Greetings' -on: [pull_request_target, issues] +on: + issues: + types: [opened] + pull_request_target: + types: [opened] + +permissions: + issues: write + pull-requests: write jobs: - greeting: + welcome: runs-on: ubuntu-latest - permissions: - issues: write - pull-requests: write + steps: + - name: Check out repository + uses: actions/checkout@v2 + - name: Greet first-time contributors id: greet uses: actions/first-interaction@v1 @@ -18,3 +27,27 @@ jobs: Hi there! 👋 Thank you for opening your first issue on CodeHarborHub. We're excited to hear your thoughts and help you out. Please provide as much detail as you can so we can assist you effectively. pr-message: | Hi there! 👋 Thank you for submitting your first pull request to CodeHarborHub. We appreciate your contribution! Our team will review it soon. If you have any questions or need further assistance, feel free to reach out. + + - name: Assign issue or pull request to team member + if: github.event_name == 'issues' || github.event_name == 'pull_request_target' + run: | + ISSUE_NUMBER=${{ github.event.issue.number || github.event.pull_request.number }} + curl -X POST -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + -d '{"assignees":["team-member"]}' \ + "https://api.github.com/repos/${{ github.repository }}/issues/${ISSUE_NUMBER}" + + - name: Welcome message for community contributors + if: github.event_name == 'issues' || github.event_name == 'pull_request_target' + uses: EddieHubCommunity/gh-action-community/src/welcome@main + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + issue-message: "Hi there! Thanks for opening this issue. We appreciate your contribution to this open-source project. We aim to respond or assign your issue as soon as possible." + pr-message: "Great job, @${{ github.actor }}! 🎉 Thank you for submitting your pull request to CodeHarborHub. We appreciate your contribution! Our team will review it soon. If you have any questions or need further assistance, feel free to reach out." + + - name: Label first-time contributions + if: github.event_name == 'issues' || github.event_name == 'pull_request_target' + run: | + ISSUE_NUMBER=${{ github.event.issue.number || github.event.pull_request.number }} + curl -X POST -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + -d '{"labels":["first-time contribution"]}' \ + "https://api.github.com/repos/${{ github.repository }}/issues/${ISSUE_NUMBER}" \ No newline at end of file