Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions .github/scripts/welcomeScript.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
module.exports = async ({ github, context }) => {
const owner = context.repo.owner;
const repo = context.repo.repo;
const issueNumber = context.issue.number;
const eventName = context.eventName;
const ghUsername = context.payload.sender.login;

try {
const issueAssociation =
context.payload.issue?.author_association;

if (
eventName === 'issues' &&
issueAssociation === 'FIRST_TIMER'
) {
return await github.rest.issues.createComment({
owner,
repo,
issue_number: issueNumber,
body: `👋 Thanks for opening your first issue, @${ghUsername}!

We appreciate your contribution and are excited to have you here. Please make sure to follow the contribution guidelines and provide as much detail as possible.

To stay updated, ask questions, and connect with maintainers and contributors, please join our Discord community:
https://discord.gg/QueQN83wn

Looking forward to collaborating with you!`
});
}

const prAssociation =
context.payload.pull_request?.author_association;

if (
eventName === 'pull_request_target' &&
(
prAssociation === 'FIRST_TIMER' ||
prAssociation === 'FIRST_TIME_CONTRIBUTOR'
)
) {
return await github.rest.issues.createComment({
owner,
repo,
issue_number: issueNumber,
body: `🎉 Thanks for your first contribution, @${ghUsername}!

We're excited to have you here. A maintainer will review your PR soon. Please check CI results and review any feedback if needed.

To stay updated, ask questions, and connect with maintainers and contributors, please join our Discord community:
https://discord.gg/QueQN83wn

Looking forward to collaborating with you!`
});
}

} catch (error) {
console.error(error);
}
};
3 changes: 3 additions & 0 deletions .github/workflows/unassign-unlinked-issues.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ jobs:
issues: write

steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd #v6.0.2

- name: Unassign issues with no linked PR and notify
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 #v9.0.0
with:
Expand Down
27 changes: 27 additions & 0 deletions .github/workflows/welcome-first-time.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Welcome First-Time Contributors

on:
issues:
types: [opened]
pull_request_target:
types: [opened]

permissions:
issues: write
pull-requests: write

jobs:
welcome:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd #v6.0.2

- name: Welcome first-time contributor
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const script = require('./.github/scripts/welcomeScript.js');
await script({ github, context });