dev: fix peril
This commit is contained in:
parent
86fff57bc0
commit
d093a22c28
7
.github/peril/README.md
vendored
7
.github/peril/README.md
vendored
@ -1 +1,8 @@
|
|||||||
Based on https://github.com/gatsbyjs/gatsby/tree/master/peril.
|
Based on https://github.com/gatsbyjs/gatsby/tree/master/peril.
|
||||||
|
|
||||||
|
## Update a code
|
||||||
|
|
||||||
|
```bash
|
||||||
|
heroku ps:restart web --app golangci-peril
|
||||||
|
heroku logs --app golangci-peril -t
|
||||||
|
```
|
||||||
|
9
.github/peril/rules/invite-collaborator.ts
vendored
9
.github/peril/rules/invite-collaborator.ts
vendored
@ -28,7 +28,7 @@ export const inviteCollaborator = async () => {
|
|||||||
|
|
||||||
// Check whether or not we’ve already invited this contributor.
|
// Check whether or not we’ve already invited this contributor.
|
||||||
try {
|
try {
|
||||||
const inviteCheck = (await api.orgs.getTeamMembership({
|
const inviteCheck = (await api.teams.getMembership({
|
||||||
team_id: teamId,
|
team_id: teamId,
|
||||||
username,
|
username,
|
||||||
} as any)) as any;
|
} as any)) as any;
|
||||||
@ -41,12 +41,15 @@ export const inviteCollaborator = async () => {
|
|||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} catch (_) {
|
} catch (err) {
|
||||||
|
console.info(
|
||||||
|
`Error checking membership of ${username} in team ${teamId}: ${err.stack}`
|
||||||
|
);
|
||||||
// If the user hasn’t been invited, the invite check throws an error.
|
// If the user hasn’t been invited, the invite check throws an error.
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const invite = await api.orgs.addTeamMembership({
|
const invite = await api.teams.addOrUpdateMembership({
|
||||||
team_id: teamId,
|
team_id: teamId,
|
||||||
username,
|
username,
|
||||||
} as any);
|
} as any);
|
||||||
|
@ -19,9 +19,9 @@ beforeEach(() => {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
api: {
|
api: {
|
||||||
orgs: {
|
teams: {
|
||||||
getTeamMembership: () => Promise.resolve({ meta: { status: "404" } }),
|
getMembership: () => Promise.resolve({ meta: { status: "404" } }),
|
||||||
addTeamMembership: jest.fn(() =>
|
addOrUpdateMembership: jest.fn(() =>
|
||||||
Promise.resolve({ data: { state: "pending" } })
|
Promise.resolve({ data: { state: "pending" } })
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user