Skip to content

Keep up to date with agpt #2

Keep up to date with agpt

Keep up to date with agpt #2

name: Label Contributor
on:
issues:
types: [opened]
pull_request:
types: [opened]
jobs:
add-label:
runs-on: ubuntu-latest
steps:
- name: Add Contributor label to specific users' issues and PRs
uses: actions/github-script@v7
with:
script: |
const exemptLabel = 'Contributor';
const exemptUsers = ['ph-ausseil']; // Add usernames here
async function isPreviousContributor(username) {
const contributors = await github.rest.repos.listContributors({
owner: github.context.repo.owner,
repo: github.context.repo.repo
});
return contributors.data.some(contributor => contributor.login === username);
}
async function run() {
const isExemptUser = exemptUsers.includes(github.actor);
const isContributor = await isPreviousContributor(github.actor);
if (isExemptUser || isContributor) {
const issueOrPrNumber = (github.context.payload.issue || github.context.payload.pull_request).number;
await github.rest.issues.addLabels({
owner: github.context.repo.owner,
repo: github.context.repo.repo,
issue_number: issueOrPrNumber,
labels: [exemptLabel]
});
}
}
run();