mirror of
https://github.com/NVIDIA/OpenShell.git
synced 2026-10-22 06:19:47 +08:00
Bumps [actions/github-script](https://github.com/actions/github-script) from 7 to 9. - [Release notes](https://github.com/actions/github-script/releases) - [Commits](https://github.com/actions/github-script/compare/v7...v9) --- updated-dependencies: - dependency-name: actions/github-script dependency-version: '9' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
58 lines
1.7 KiB
YAML
58 lines
1.7 KiB
YAML
name: Issue Triage Gate
|
|
|
|
on:
|
|
issues:
|
|
types: [opened]
|
|
|
|
permissions:
|
|
issues: write
|
|
|
|
jobs:
|
|
label-non-maintainer-issues:
|
|
runs-on: ubuntu-latest
|
|
if: github.repository_owner == 'NVIDIA'
|
|
steps:
|
|
- name: Check contributor permissions
|
|
id: contributor
|
|
uses: actions/github-script@v9
|
|
with:
|
|
result-encoding: string
|
|
script: |
|
|
const author = context.payload.issue.user.login;
|
|
const maintainerPermissions = ['admin', 'maintain', 'write'];
|
|
|
|
try {
|
|
const { data } = await github.rest.repos.getCollaboratorPermissionLevel({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
username: author,
|
|
});
|
|
|
|
if (maintainerPermissions.includes(data.permission)) {
|
|
console.log(`${author} has maintainer permissions: ${data.permission}.`);
|
|
return 'false';
|
|
}
|
|
|
|
console.log(`${author} is not a maintainer; permission is ${data.permission}.`);
|
|
return 'true';
|
|
} catch (e) {
|
|
if (e.status === 404) {
|
|
console.log(`${author} is not a repository collaborator; labeling for triage.`);
|
|
return 'true';
|
|
}
|
|
|
|
throw e;
|
|
}
|
|
|
|
- name: Add triage label
|
|
if: steps.contributor.outputs.result == 'true'
|
|
uses: actions/github-script@v9
|
|
with:
|
|
script: |
|
|
await github.rest.issues.addLabels({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
issue_number: context.issue.number,
|
|
labels: ['state:triage-needed'],
|
|
});
|