Skip to content

Commit 1d6d4f5

Browse files
authored
Remove invite-contributor job from ReopBot.yml
Removed the invite-contributor job from the ReopBot workflow.
1 parent a9f70ba commit 1d6d4f5

File tree

1 file changed

+0
-79
lines changed

1 file changed

+0
-79
lines changed

.github/workflows/ReopBot.yml

Lines changed: 0 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -13,85 +13,6 @@ permissions:
1313
pull-requests: write
1414

1515
jobs:
16-
invite-contributor:
17-
runs-on: ubuntu-latest
18-
if: github.event_name == 'pull_request_target' && github.event.pull_request.merged == true
19-
steps:
20-
- name: Invite contributor
21-
id: invite-contributor
22-
uses: actions/github-script@v6
23-
with:
24-
github-token: ${{ secrets.PAT_WITH_INVITE_PERMISSIONS }}
25-
script: |
26-
const { owner, repo } = context.repo;
27-
const username = context.payload.pull_request.user.login;
28-
29-
console.log(`Checking if ${username} is already a collaborator...`);
30-
31-
try {
32-
const { data: permissionLevel } = await github.rest.repos.getCollaboratorPermissionLevel({
33-
owner,
34-
repo,
35-
username,
36-
});
37-
38-
if (permissionLevel.permission === 'admin' || permissionLevel.permission === 'write') {
39-
console.log(`${username} is already a collaborator with sufficient permissions.`);
40-
return;
41-
}
42-
43-
console.log(`${username} is a collaborator but needs permission update.`);
44-
} catch (error) {
45-
if (error.status !== 404) {
46-
console.error(`Error checking collaborator status: ${error.message}`);
47-
throw error;
48-
}
49-
console.log(`${username} is not a collaborator.`);
50-
}
51-
52-
try {
53-
console.log(`Inviting ${username} as a collaborator...`);
54-
const response = await github.rest.repos.addCollaborator({
55-
owner,
56-
repo,
57-
username,
58-
permission: 'push'
59-
});
60-
61-
if (response.status === 201) {
62-
console.log(`Invitation sent to ${username} as a collaborator with push permission.`);
63-
core.setOutput('invitation_sent', 'true');
64-
} else if (response.status === 204) {
65-
console.log(`${username}'s permissions updated to push.`);
66-
core.setOutput('invitation_sent', 'false');
67-
}
68-
} catch (error) {
69-
console.error(`Error inviting/updating collaborator: ${error.message}`);
70-
core.setFailed(`Error inviting/updating collaborator: ${error.message}`);
71-
}
72-
73-
- name: Comment on PR
74-
if: steps.invite-contributor.outputs.invitation_sent == 'true'
75-
uses: actions/github-script@v6
76-
with:
77-
github-token: ${{ secrets.GITHUB_TOKEN }}
78-
script: |
79-
const { owner, repo } = context.repo;
80-
const issue_number = context.payload.pull_request.number;
81-
const username = context.payload.pull_request.user.login;
82-
try {
83-
await github.rest.issues.createComment({
84-
owner,
85-
repo,
86-
issue_number,
87-
body: `Thanks for your contribution, @${username}! You've been invited as a collaborator with push permissions. Please check your email for the invitation.`
88-
});
89-
console.log(`Comment posted on PR #${issue_number}`);
90-
} catch (error) {
91-
console.error(`Error posting comment: ${error.message}`);
92-
core.setFailed(`Error posting comment: ${error.message}`);
93-
}
94-
9516
update-readme:
9617
runs-on: ubuntu-latest
9718
if: github.event_name == 'schedule' || github.event_name == 'push'

0 commit comments

Comments
 (0)