Skip to content

fix(cloud): implement batching for upload to avoid API limit #14

fix(cloud): implement batching for upload to avoid API limit

fix(cloud): implement batching for upload to avoid API limit #14

Workflow file for this run

name: Welcome First-Time Contributors
on:
pull_request_target:
types: [opened]
issues:
types: [opened]
permissions:
issues: write
pull-requests: write
jobs:
welcome:
runs-on: ubuntu-latest
steps:
- name: Welcome first-time contributors
uses: actions/github-script@v7
with:
script: |
const isIssue = context.eventName === 'issues';
const isPR = context.eventName === 'pull_request_target';
const creator = context.payload.sender.login;
// Check if this is the user's first contribution
const { data: contributions } = await github.rest.repos.listPullRequestsAssociatedWithCommit({
owner: context.repo.owner,
repo: context.repo.repo,
commit_sha: context.payload.pull_request?.head?.sha || 'HEAD'
}).catch(() => ({ data: [] }));
// For PRs, check if this is their first PR
if (isPR) {
const { data: prs } = await github.rest.pulls.list({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'all',
creator: creator,
per_page: 100
});
// If this is their first PR (only 1 PR from this user)
if (prs.length === 1) {
const welcomeMessage = [
`👋 Hey @${creator}, Thank you for opening your first pull request! We\'re excited to have you as a contributor to the project.`,
'',
'**Quick reminders:**',
'- Update `CHANGELOG.md` under `[Unreleased]` (or add `skip changelog` label)',
'- Make sure CI checks pass',
'- Check out [CONTRIBUTING.md](https://github.com/mathtechstudio/roblox-slang/blob/main/CONTRIBUTING.md) if you need help',
'',
'A maintainer will review your changes soon. Thanks for contributing! 🚀'
].join('\n');
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
body: welcomeMessage
});
}
}
// For Issues, check if this is their first issue
if (isIssue) {
const { data: issues } = await github.rest.issues.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'all',
creator: creator,
per_page: 100
});
// If this is their first issue (only 1 issue from this user)
if (issues.length === 1) {
const welcomeMessage = [
`👋 Hey @${creator}, thanks for opening your first issue!`,
'',
'A maintainer will review and label this soon. Feel free to add more details if needed.',
'',
'Want to work on this yourself? Check out [CONTRIBUTING.md](https://github.com/mathtechstudio/roblox-slang/blob/main/CONTRIBUTING.md) to get started!'
].join('\n');
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.issue.number,
body: welcomeMessage
});
}
}