|
| 1 | +name: Welcome first-time contributors |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request_target: |
| 5 | + types: [opened] |
| 6 | + |
| 7 | +permissions: {} |
| 8 | + |
| 9 | +jobs: |
| 10 | + agentscan: |
| 11 | + if: >- |
| 12 | + github.run_attempt == 1 && |
| 13 | + github.repository == 'nodejs/node' && |
| 14 | + (github.event.pull_request.author_association == 'FIRST_TIMER' || |
| 15 | + github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR') |
| 16 | + runs-on: ubuntu-slim |
| 17 | + permissions: |
| 18 | + contents: read |
| 19 | + outputs: |
| 20 | + scan_outcome: ${{ steps.agentscan.outcome }} |
| 21 | + classification: ${{ steps.agentscan.outputs.classification }} |
| 22 | + community_flagged: ${{ steps.agentscan.outputs['community-flagged'] }} |
| 23 | + steps: |
| 24 | + - name: Scan contributor activity |
| 25 | + id: agentscan |
| 26 | + # The welcome should still be posted if this advisory scan fails. |
| 27 | + continue-on-error: true |
| 28 | + uses: MatteoGabriele/agentscan-action@98202262c925c508d4c1424b1dfbe17ee35b0c02 # v2.4.0 |
| 29 | + with: |
| 30 | + github-token: ${{ github.token }} |
| 31 | + mode: silent |
| 32 | + scan-pull-requests: true |
| 33 | + scan-issues: false |
| 34 | + auto-close: false |
| 35 | + honeypot: false |
| 36 | + |
| 37 | + comment: |
| 38 | + needs: agentscan |
| 39 | + runs-on: ubuntu-slim |
| 40 | + permissions: |
| 41 | + pull-requests: write |
| 42 | + steps: |
| 43 | + - name: Welcome first-time contributor |
| 44 | + env: |
| 45 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 46 | + NUMBER: ${{ github.event.pull_request.number }} |
| 47 | + AGENTSCAN_OUTCOME: ${{ needs.agentscan.outputs.scan_outcome }} |
| 48 | + AGENTSCAN_CLASSIFICATION: ${{ needs.agentscan.outputs.classification }} |
| 49 | + AGENTSCAN_COMMUNITY_FLAGGED: ${{ needs.agentscan.outputs.community_flagged }} |
| 50 | + WELCOME_MESSAGE: >2- |
| 51 | + Welcome to Node.js, and thank you for your first contribution! |
| 52 | +
|
| 53 | + Before review, please take a moment to read: |
| 54 | +
|
| 55 | + * the [guide for first-time contributors](https://github.com/nodejs/node/blob/HEAD/doc/contributing/first-contributions.md) |
| 56 | + * the [contribution and automation policies](https://github.com/nodejs/node/blob/HEAD/CONTRIBUTING.md) |
| 57 | + * the [pull request guide](https://github.com/nodejs/node/blob/HEAD/doc/contributing/pull-requests.md) |
| 58 | + * the [AI use policy](https://github.com/nodejs/node/blob/HEAD/doc/contributing/ai-guidelines.md) |
| 59 | + * the [Code of Conduct](https://github.com/nodejs/admin/blob/HEAD/CODE_OF_CONDUCT.md) |
| 60 | +
|
| 61 | + Please make sure every commit is |
| 62 | + [signed off](https://github.com/nodejs/node/blob/HEAD/doc/contributing/pull-requests.md#step-4-commit). |
| 63 | + For a first pull request, GitHub Actions require collaborator |
| 64 | + approval and Jenkins CI must be started by a collaborator or triager, |
| 65 | + so an initial wait is normal. |
| 66 | + CAUTION_MESSAGE: >- |
| 67 | + > [!CAUTION] |
| 68 | +
|
| 69 | + > AgentScan found account activity patterns that may be consistent with |
| 70 | + automation. This is a heuristic, not proof that this pull request was |
| 71 | + opened by an agent or violates policy. AI-assisted contributions are |
| 72 | + permitted, but automated tooling must not open pull requests without |
| 73 | + advance approval, and contributors must personally understand, test, |
| 74 | + verify, and take responsibility for every submitted change. See the |
| 75 | + [AgentScan analysis](https://agentscan.tools/user/${{ github.event.pull_request.user.login }}), |
| 76 | + [AI use policy](https://github.com/nodejs/node/blob/HEAD/doc/contributing/ai-guidelines.md), |
| 77 | + and |
| 78 | + [automation policy](https://github.com/nodejs/node/blob/HEAD/CONTRIBUTING.md#automation-and-bots) |
| 79 | + for additional context. |
| 80 | + run: | |
| 81 | + add_caution=false |
| 82 | + if [[ "$AGENTSCAN_OUTCOME" == "success" ]]; then |
| 83 | + case "$AGENTSCAN_CLASSIFICATION" in |
| 84 | + mixed|automation) |
| 85 | + add_caution=true |
| 86 | + ;; |
| 87 | + esac |
| 88 | + if [[ "$AGENTSCAN_COMMUNITY_FLAGGED" == "true" ]]; then |
| 89 | + add_caution=true |
| 90 | + fi |
| 91 | + fi |
| 92 | +
|
| 93 | + if [[ "$add_caution" == "true" ]]; then |
| 94 | + printf '%s\n\n%s\n' "$WELCOME_MESSAGE" "$CAUTION_MESSAGE" |
| 95 | + else |
| 96 | + printf '%s\n' "$WELCOME_MESSAGE" |
| 97 | + fi | gh pr comment "$NUMBER" --repo "$GITHUB_REPOSITORY" --body-file - |
0 commit comments