-
Notifications
You must be signed in to change notification settings - Fork 3
72 lines (60 loc) · 2.89 KB
/
on-issue-opened.yml
File metadata and controls
72 lines (60 loc) · 2.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# SPDX-License-Identifier: Apache-2.0
# Licensed to the Ed-Fi Alliance under one or more agreements.
# The Ed-Fi Alliance licenses this file to you under the Apache License, Version 2.0.
# See the LICENSE and NOTICES files in the project root for more information.
name: "Issue Management"
on:
issues:
types: [opened]
permissions:
issues: write
jobs:
manage-community-issues:
runs-on: ubuntu-latest
if: github.event.issue.user.type != 'Bot'
steps:
- name: Check if user has repository access
id: check-repo-access
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
with:
script: |
try {
// Check if user has repository access (collaborator, maintainer, admin, etc.)
const { data: permission } = await github.rest.repos.getCollaboratorPermissionLevel({
owner: context.repo.owner,
repo: context.repo.repo,
username: context.payload.issue.user.login
});
console.log(`User ${context.payload.issue.user.login} repository permission: ${permission.permission}`);
return ['admin', 'maintain', 'write', 'triage'].includes(permission.permission);
} catch (error) {
console.log(`User ${context.payload.issue.user.login} does not have repository access: ${error.message}`);
return false;
}
- name: Close community issue with helpful message
if: steps.check-repo-access.outputs.result == 'false'
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
with:
script: |
const message = `Thank you for your interest in Ed-Fi!
This GitHub repository is maintained by the Ed-Fi engineering team for internal issue tracking and development coordination.
For technical support, questions, and community discussions, please visit the **[Ed-Fi Community Hub](https://community.ed-fi.org)** where our community and support team can better assist you.
The Ed-Fi Community Hub provides:
- Technical support and troubleshooting
- Community discussions and best practices
- Documentation and resources
- Direct access to Ed-Fi experts
We appreciate your understanding and look forward to helping you on the Community Hub!`;
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: message
});
await github.rest.issues.update({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
state: 'closed',
state_reason: 'not_planned'
});