diff --git a/.github/workflows/welcome-good-first-issue.yml b/.github/workflows/welcome-good-first-issue.yml new file mode 100644 index 0000000000..7ad31ed1e3 --- /dev/null +++ b/.github/workflows/welcome-good-first-issue.yml @@ -0,0 +1,50 @@ +name: Welcome Good First Issue + +on: + issues: + types: [labeled] + +permissions: + issues: write + +jobs: + comment-on-good-first-issue: + if: github.event.label.name == 'good first issue' + runs-on: ubuntu-latest + steps: + - name: Check if welcome comment already exists + id: check_comment + uses: actions/github-script@v7 + with: + result-encoding: string + script: | + const issueNumber = context.issue.number; + const comments = await github.rest.issues.listComments({ + ...context.repo, + issue_number: issueNumber + }); + + const alreadyCommented = comments.data.some( + (comment) => + comment.body.includes('') + ); + + return alreadyCommented ? 'true' : 'false'; + + - name: Leave welcome comment + if: steps.check_comment.outputs.result == 'false' + uses: actions/github-script@v7 + with: + script: | + const repoUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}`; + + await github.rest.issues.createComment({ + ...context.repo, + issue_number: context.issue.number, + body: "🙌 **Hey there, future contributor!** 🙌\n\n" + + "This issue has been labeled as **good first issue**, which means it's a great place to get started with the OpenHands project.\n\n" + + "If you're interested in working on it, feel free to! No need to ask for permission.\n\n" + + "Be sure to check out our [development setup guide](" + repoUrl + "/blob/main/Development.md) to get your environment set up, and follow our [contribution guidelines](" + repoUrl + "/blob/main/CONTRIBUTING.md) when you're ready to submit a fix.\n\n" + + "🙌 Happy hacking! 🙌\n\n" + + "" + });