Skip to content

Commit 6416a6b

Browse files
authored
Merge pull request #1981 from gitgitgadget/more-gitgitgadget-github-actions-prerequisites
More prerequisites to move GitGitGadget towards GitHub Actions
2 parents 30956fe + 902f7dd commit 6416a6b

File tree

12 files changed

+64
-195
lines changed

12 files changed

+64
-195
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,3 @@
1010
/obj/**
1111
/*.sln*
1212
/*.njsproj*
13-
/*.tgz

eslint.config.mjs

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import eslint from "@eslint/js";
2-
import stylistic from "@stylistic/eslint-plugin";
3-
import jsdoc from "eslint-plugin-jsdoc";
4-
import eslintConfigPrettier from "eslint-config-prettier";
5-
import eslintPluginPrettier from "eslint-plugin-prettier";
6-
import eslintPluginSecurity from "eslint-plugin-security";
7-
import globals from "globals";
8-
import tseslint from "typescript-eslint";
1+
import eslint from "@eslint/js"
2+
import stylistic from "@stylistic/eslint-plugin"
3+
import jsdoc from "eslint-plugin-jsdoc"
4+
import eslintConfigPrettier from "eslint-config-prettier"
5+
import eslintPluginPrettier from "eslint-plugin-prettier"
6+
import eslintPluginSecurity from "eslint-plugin-security"
7+
import globals from "globals"
8+
import tseslint from "typescript-eslint"
99

1010
export default tseslint.config(
1111
{
@@ -127,6 +127,18 @@ export default tseslint.config(
127127
"security/detect-object-injection": "off",
128128
},
129129
},
130+
{
131+
files: ["**/*.js", "**/*.mjs"],
132+
rules: {
133+
"@stylistic/semi": ["error", "never"],
134+
"prettier/prettier": [
135+
"warn",
136+
{
137+
semi: false,
138+
},
139+
],
140+
},
141+
},
130142
{
131143
files: ["tests/*.ts", "lib/*.ts", "script/*.ts"],
132144
extends: [...tseslint.configs.recommendedTypeChecked],
@@ -181,4 +193,4 @@ export default tseslint.config(
181193
},
182194
},
183195
// eslintPluginPrettierRecommended,
184-
);
196+
)

lib/ci-helper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ export class CIHelper {
524524
const prKey = getPullRequestKeyFromURL(prMeta.pullRequestURL);
525525
const fetchURL = `https://github.com/${prKey.owner}/${prKey.repo}`;
526526
const fetchRef = `refs/pull/${prKey.pull_number}/head`;
527-
await git(["fetch", fetchURL, fetchRef, prMeta.latestTag], {
527+
await git(["fetch", "--no-tags", fetchURL, fetchRef, prMeta.latestTag], {
528528
workDir: this.workDir,
529529
});
530530
}

lib/git-notes.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export class GitNotes {
3939
// wait a while before trying again to push (after fetching the remote notes ref and merging it)
4040
await sleep(backoff);
4141

42-
const output = await git(["fetch", "--porcelain", url, "--", `${this.notesRef}`], {
42+
const output = await git(["fetch", "--porcelain", "--no-tags", url, "--", `${this.notesRef}`], {
4343
workDir: this.workDir,
4444
});
4545
// parse the output to obtain the OID of the remote notes ref
@@ -122,7 +122,7 @@ export class GitNotes {
122122

123123
public async update(url: string): Promise<void> {
124124
if (this.notesRef.match(/^refs\/notes\/(gitgitgadget|commit-to-mail|mail-to-commit)$/)) {
125-
await git(["fetch", url, `+${this.notesRef}:${this.notesRef}`], { workDir: this.workDir });
125+
await git(["fetch", "--no-tags", url, `+${this.notesRef}:${this.notesRef}`], { workDir: this.workDir });
126126
} else {
127127
throw new Error(`Don't know how to update ${this.notesRef}`);
128128
}

lib/git.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,12 @@ function trimTrailingNewline(str: string): string {
3737
* @throws {Error} if the command fails
3838
*/
3939
export function git(args: string[], options?: IGitOptions): Promise<string> {
40+
let workDir = (options && options.workDir) || ".";
4041
// allow the command to run in a bare repository
41-
if (options?.workDir?.endsWith(".git")) args = [`--git-dir=${options.workDir}`, ...args];
42-
43-
const workDir = (options && options.workDir) || ".";
42+
if (options?.workDir?.endsWith(".git")) {
43+
args = [`--git-dir=${options.workDir}`, ...args];
44+
workDir = ".";
45+
}
4446
if (options && options.trace) {
4547
process.stderr.write(`Called 'git ${args.join(" ")}' in '${workDir}':\n${new Error().stack}\n`);
4648
}

lib/gitgitgadget.ts

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,13 @@ export class GitGitGadget {
5959

6060
// Always fetch the Git notes first thing
6161
await git(
62-
["fetch", publishTagsAndNotesToRemote, "--", `+${GitNotes.defaultNotesRef}:${GitNotes.defaultNotesRef}`],
62+
[
63+
"fetch",
64+
"--no-tags",
65+
publishTagsAndNotesToRemote,
66+
"--",
67+
`+${GitNotes.defaultNotesRef}:${GitNotes.defaultNotesRef}`,
68+
],
6369
{ workDir },
6470
);
6571

@@ -215,6 +221,7 @@ export class GitGitGadget {
215221
const pullRequestMerge = `refs/pull/${pullRequestNumber}/merge`;
216222
const args = [
217223
"fetch",
224+
"--no-tags",
218225
this.publishTagsAndNotesToRemote,
219226
"--",
220227
`+${this.notes.notesRef}:${this.notes.notesRef}`,
@@ -233,9 +240,12 @@ export class GitGitGadget {
233240
if (repositoryOwner === this.config.repo.owner) {
234241
args.push(...prArgs);
235242
} else {
236-
await git(["fetch", `https://github.com/${repositoryOwner}/${this.config.repo.name}`, ...prArgs], {
237-
workDir: this.workDir,
238-
});
243+
await git(
244+
["fetch", "--no-tags", `https://github.com/${repositoryOwner}/${this.config.repo.name}`, ...prArgs],
245+
{
246+
workDir: this.workDir,
247+
},
248+
);
239249
}
240250
await git(args, { workDir: this.workDir });
241251

@@ -249,6 +259,7 @@ export class GitGitGadget {
249259
await git(
250260
[
251261
"fetch",
262+
"--no-tags",
252263
this.publishTagsAndNotesToRemote,
253264
"--",
254265
`+${GitNotes.defaultNotesRef}:${GitNotes.defaultNotesRef}`,

lib/mail-commit-mapping.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,17 @@ export class MailCommitMapping {
4343
}
4444
if (refs.length) {
4545
console.log(`Updating mail-to-commit/refs: ${refs.join(", ")}`);
46-
await git(["fetch", `https://github.com/${this.config.repo.owner}/${this.config.repo.name}`, ...refs], {
47-
workDir: this.workDir,
48-
});
46+
await git(
47+
[
48+
"fetch",
49+
"--no-tags",
50+
`https://github.com/${this.config.repo.owner}/${this.config.repo.name}`,
51+
...refs,
52+
],
53+
{
54+
workDir: this.workDir,
55+
},
56+
);
4957
}
5058
}
5159
}

lib/misc-action.ts

Lines changed: 0 additions & 84 deletions
This file was deleted.

lib/pull-action.ts

Lines changed: 0 additions & 76 deletions
This file was deleted.

package.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@
2525
"url": "https://github.com/gitgitgadget/gitgitgadget/issues"
2626
},
2727
"homepage": "https://gitgitgadget.github.io/",
28-
"files": [
29-
"lib/*.ts"
30-
],
3128
"jest": {
3229
"extensionsToTreatAsEsm": [
3330
".ts"

0 commit comments

Comments
 (0)