Skip to content

Commit 2a202e9

Browse files
committed
Fix indentation
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent 49fb949 commit 2a202e9

8 files changed

Lines changed: 146 additions & 143 deletions

.eslintrc.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,8 @@
77
"parserOptions": {
88
"ecmaVersion": 12,
99
"sourceType": "module"
10+
},
11+
"rules": {
12+
"indent": ["error", 4]
1013
}
1114
}

GitForWindowsHelper/azure-pipelines.js

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -79,24 +79,24 @@ const getRelease = async (context, token, organization, project, releaseId) => {
7979
}
8080

8181
const createRelease = async (
82-
context,
83-
token,
84-
organization,
85-
project,
86-
releaseDefinitionId,
87-
artifactAlias,
88-
artifactBuildRunId,
89-
artifactBuildRunName,
90-
artifactBuildDefinitionId,
91-
artifactBuildDefinitionName,
92-
sourceBranch,
93-
sourceCommitId,
94-
repo
82+
context,
83+
token,
84+
organization,
85+
project,
86+
releaseDefinitionId,
87+
artifactAlias,
88+
artifactBuildRunId,
89+
artifactBuildRunName,
90+
artifactBuildDefinitionId,
91+
artifactBuildDefinitionName,
92+
sourceBranch,
93+
sourceCommitId,
94+
repo
9595
) => {
9696
const auth = Buffer.from("PAT:" + token).toString("base64");
9797
const headers = {
98-
Accept: "application/json; api-version=7.0; excludeUrls=true",
99-
Authorization: "Basic " + auth,
98+
Accept: "application/json; api-version=7.0; excludeUrls=true",
99+
Authorization: "Basic " + auth,
100100
};
101101
const body = {
102102
definitionId: releaseDefinitionId,
@@ -157,19 +157,19 @@ const releaseGitArtifacts = async (context, prNumber) => {
157157

158158
const token = process.env['AZURE_PIPELINE_TRIGGER_TOKEN']
159159
const answer2 = await createRelease(
160-
context,
161-
token,
162-
'git-for-windows',
163-
'git',
164-
1,
165-
'artifacts',
166-
artifactBuildRunId,
167-
artifactBuildRunName,
168-
artifactBuildDefinitionId,
169-
artifactBuildDefinitionName,
170-
sourceBranch,
171-
sourceCommitId,
172-
'git-for-windows/git'
160+
context,
161+
token,
162+
'git-for-windows',
163+
'git',
164+
1,
165+
'artifacts',
166+
artifactBuildRunId,
167+
artifactBuildRunName,
168+
artifactBuildDefinitionId,
169+
artifactBuildDefinitionName,
170+
sourceBranch,
171+
sourceCommitId,
172+
'git-for-windows/git'
173173
)
174174
return {
175175
id: answer2.id,

GitForWindowsHelper/check-runs.js

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -2,64 +2,64 @@ const queueCheckRun = async (context, token, owner, repo, ref, checkRunName, tit
22
const githubApiRequest = require('./github-api-request')
33
// is there an existing check-run we can re-use?
44
const { check_runs } = await githubApiRequest(
5-
context,
6-
token,
7-
'GET',
8-
`/repos/${owner}/${repo}/commits/${ref}/check-runs`
5+
context,
6+
token,
7+
'GET',
8+
`/repos/${owner}/${repo}/commits/${ref}/check-runs`
99
)
1010
const filtered = check_runs
11-
.filter(e => e.name === checkRunName && e.conclusion === null).map(e => {
12-
return {
13-
id: e.id,
14-
status: e.status
15-
}
16-
})
11+
.filter(e => e.name === checkRunName && e.conclusion === null).map(e => {
12+
return {
13+
id: e.id,
14+
status: e.status
15+
}
16+
})
1717
if (filtered.length > 0) {
18-
// ensure that the check_run is set to status "in progress"
19-
if (filtered[0].status !== 'queued') {
20-
console.log(await githubApiRequest(
21-
context,
22-
token,
23-
'PATCH',
24-
`/repos/${owner}/${repo}/check-runs/${filtered[0].id}`, {
25-
status: 'queued'
26-
}
27-
))
28-
}
29-
process.stderr.write(`Returning existing ${filtered[0].id}`)
30-
return filtered[0].id
18+
// ensure that the check_run is set to status "in progress"
19+
if (filtered[0].status !== 'queued') {
20+
console.log(await githubApiRequest(
21+
context,
22+
token,
23+
'PATCH',
24+
`/repos/${owner}/${repo}/check-runs/${filtered[0].id}`, {
25+
status: 'queued'
26+
}
27+
))
28+
}
29+
process.stderr.write(`Returning existing ${filtered[0].id}`)
30+
return filtered[0].id
3131
}
3232

3333
const { id } = await githubApiRequest(
34-
context,
35-
token,
36-
'POST',
37-
`/repos/${owner}/${repo}/check-runs`, {
38-
name: checkRunName,
39-
head_sha: ref,
40-
status: 'queued',
41-
output: {
42-
title,
43-
summary
34+
context,
35+
token,
36+
'POST',
37+
`/repos/${owner}/${repo}/check-runs`, {
38+
name: checkRunName,
39+
head_sha: ref,
40+
status: 'queued',
41+
output: {
42+
title,
43+
summary
44+
}
4445
}
45-
}
4646
)
4747
return id
48-
}
48+
}
4949

50-
const updateCheckRun = async (context, token, owner, repo, checkRunId, parameters) => {
50+
const updateCheckRun = async (context, token, owner, repo, checkRunId, parameters) => {
5151
const githubApiRequest = require('./github-api-request')
5252

53-
await githubApiRequest(
54-
context,
55-
token,
56-
'PATCH',
57-
`/repos/${owner}/${repo}/check-runs/${checkRunId}`,
58-
parameters
53+
await githubApiRequest(
54+
context,
55+
token,
56+
'PATCH',
57+
`/repos/${owner}/${repo}/check-runs/${checkRunId}`,
58+
parameters
5959
)
60-
}
60+
}
6161

62-
module.exports = {
62+
module.exports = {
6363
queueCheckRun,
6464
updateCheckRun
65-
}
65+
}
Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
// Gets the permission level of a collaborator on the specified repository
22
// Returns `ADMIN`, `MAINTAIN`, `READ`, `TRIAGE` or `WRITE`.
33
module.exports = async (context, token, owner, repo, collaborator) => {
4-
const gitHubAPIRequest = require('./github-api-request')
5-
const answer = await gitHubAPIRequest(
6-
context,
7-
token,
8-
'POST',
9-
'/graphql', {
10-
query: `query CollaboratorPermission($owner: String!, $repo: String!, $collaborator: String) {
4+
const gitHubAPIRequest = require('./github-api-request')
5+
const answer = await gitHubAPIRequest(
6+
context,
7+
token,
8+
'POST',
9+
'/graphql', {
10+
query: `query CollaboratorPermission($owner: String!, $repo: String!, $collaborator: String) {
1111
repository(owner:$owner, name:$repo) {
1212
collaborators(query: $collaborator) {
1313
edges {
@@ -16,13 +16,13 @@ module.exports = async (context, token, owner, repo, collaborator) => {
1616
}
1717
}
1818
}`,
19-
variables: {
20-
owner,
21-
repo,
22-
collaborator
23-
}
24-
}
25-
)
26-
if (answer.error) throw answer.error
27-
return answer.data.repository.collaborators.edges.map(e => e.permission.toString())
19+
variables: {
20+
owner,
21+
repo,
22+
collaborator
23+
}
24+
}
25+
)
26+
if (answer.error) throw answer.error
27+
return answer.data.repository.collaborators.edges.map(e => e.permission.toString())
2828
}

GitForWindowsHelper/github-api-request-as-app.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ module.exports = async (context, requestMethod, requestPath, body) => {
1616
}
1717

1818
const toBase64 = (obj) => Buffer.from(JSON.stringify(obj), "utf-8").toString("base64url")
19-
const headerAndPayload = `${toBase64(header)}.${toBase64(payload)}`
19+
const headerAndPayload = `${toBase64(header)}.${toBase64(payload)}`
2020

2121
const privateKey = `-----BEGIN RSA PRIVATE KEY-----\n${process.env['GITHUB_APP_PRIVATE_KEY']}\n-----END RSA PRIVATE KEY-----\n`
2222

GitForWindowsHelper/https-request.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ module.exports = async (context, hostname, method, requestPath, body, headers) =
2828
statusCode: res.statusCode,
2929
statusMessage: res.statusMessage,
3030
headers: res.headers
31-
})
31+
})
3232

3333
const chunks = []
3434
res.on('data', data => chunks.push(data))

GitForWindowsHelper/slash-commands.js

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,14 @@ module.exports = async (context, req) => {
6969
if (alreadyOpenedPR.length > 0) {
7070
({ html_url: commentURL, id: commentId } =
7171
await appendToIssueComment(
72-
context,
73-
await getToken(),
74-
owner,
75-
repo,
76-
commentId,
77-
`${
78-
packageType ? `${packageType} ` : ""
79-
}PR [already exists](${alreadyOpenedPR[0].html_url})`
72+
context,
73+
await getToken(),
74+
owner,
75+
repo,
76+
commentId,
77+
`${
78+
packageType ? `${packageType} ` : ""
79+
}PR [already exists](${alreadyOpenedPR[0].html_url})`
8080
));
8181
return
8282
}
@@ -111,14 +111,14 @@ module.exports = async (context, req) => {
111111
|| !req.body.issue.pull_request
112112
|| !['build-extra', 'MINGW-packages', 'MSYS2-packages'].includes(repo)) {
113113
return `Ignoring ${command} in unexpected repo: ${commentURL}`
114-
}
114+
}
115115

116116
await checkPermissions()
117117

118118
const { guessComponentUpdateDetails, isMSYSPackage } = require('./component-updates')
119119
const { package_name } = deployMatch[2]
120-
? { package_name: deployMatch[2] }
121-
: guessComponentUpdateDetails(req.body.issue.title, req.body.issue.body)
120+
? { package_name: deployMatch[2] }
121+
: guessComponentUpdateDetails(req.body.issue.title, req.body.issue.body)
122122

123123
// The commit hash of the tip commit is sadly not part of the
124124
// "comment.created" webhook's payload. Therefore, we have to get it
@@ -238,9 +238,9 @@ module.exports = async (context, req) => {
238238
if (owner !== 'git-for-windows'
239239
|| repo !== 'git'
240240
|| !req.body.issue.pull_request
241-
) {
241+
) {
242242
return `Ignoring ${command} in unexpected repo: ${commentURL}`
243-
}
243+
}
244244

245245
await checkPermissions()
246246
await thumbsUp()
@@ -255,11 +255,11 @@ module.exports = async (context, req) => {
255255

256256
if (command == '/release') {
257257
if (owner !== 'git-for-windows'
258-
|| repo !== 'git'
259-
|| !req.body.issue.pull_request
260-
) {
258+
|| repo !== 'git'
259+
|| !req.body.issue.pull_request
260+
) {
261261
return `Ignoring ${command} in unexpected repo: ${commentURL}`
262-
}
262+
}
263263

264264
await checkPermissions()
265265
await thumbsUp()
@@ -277,7 +277,7 @@ module.exports = async (context, req) => {
277277
if (owner !== 'git-for-windows'
278278
|| !['git', 'build-extra', 'MINGW-packages', 'MSYS2-packages'].includes(repo)) {
279279
return `Ignoring ${command} in unexpected repo: ${commentURL}`
280-
}
280+
}
281281

282282
await checkPermissions()
283283

0 commit comments

Comments
 (0)