github-action-yaml 0.0.1 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -0
- package/dist/bin/action-yaml.cjs +6 -6
- package/dist/bin/action-yaml.cjs.map +1 -1
- package/dist/bin/action-yaml.js +6 -6
- package/dist/bin/action-yaml.js.map +1 -1
- package/package.json +5 -1
- package/src/bin/action-yaml.ts +10 -6
- package/.changeset/README.md +0 -8
- package/.changeset/config.json +0 -11
- package/.github/CODEOWNERS +0 -5
- package/.github/FUNDING.yml +0 -13
- package/.github/actions/setup/action.yml +0 -32
- package/.github/renovate.json +0 -9
- package/.github/workflows/changeset-for-renovate.yml +0 -29
- package/.github/workflows/check-pr.yml +0 -43
- package/.github/workflows/release.yml +0 -56
- package/.github/workflows/wait-for-workflows.yaml +0 -18
- package/.node-version +0 -1
- package/CHANGELOG.md +0 -7
- package/biome.json +0 -29
- package/tsconfig.json +0 -10
- package/tsup.config.ts +0 -10
package/README.md
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# github-action-yaml
|
2
|
+
|
3
|
+
## Install
|
4
|
+
|
5
|
+
```bash
|
6
|
+
npm install github-action-yaml
|
7
|
+
```
|
8
|
+
|
9
|
+
## Usage
|
10
|
+
|
11
|
+
```sh
|
12
|
+
npx github-action-yaml generate ./src/generated/github-action.ts
|
13
|
+
```
|
14
|
+
|
15
|
+
## Example
|
16
|
+
|
17
|
+
```ts
|
18
|
+
import { parseInputs } from './generated/github-action';
|
19
|
+
|
20
|
+
const main = () => {
|
21
|
+
const inputs = parseInputs()
|
22
|
+
}
|
23
|
+
|
24
|
+
main()
|
25
|
+
```
|
26
|
+
|
27
|
+
### Generate Options
|
28
|
+
|
29
|
+
| Option | Description | Default | Required |
|
30
|
+
| --------------- | ----------- | ------------ | -------- |
|
31
|
+
| `output` | Output file | | true |
|
32
|
+
| `-i`, `--input` | Input file | `action.yml` | false |
|
33
|
+
| `--watch` | Watch mode | | false |
|
package/dist/bin/action-yaml.cjs
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
// src/bin/action-yaml.ts
|
4
|
+
var import_node_fs = require("fs");
|
4
5
|
var import_promises2 = require("fs/promises");
|
5
6
|
var import_node_path = require("path");
|
6
7
|
var import_commander = require("commander");
|
@@ -86,17 +87,16 @@ var universalReadFile = async (path) => {
|
|
86
87
|
|
87
88
|
// src/bin/action-yaml.ts
|
88
89
|
var program = new import_commander.Command();
|
89
|
-
program.name("generate").description("generate typescript code from action.yaml file").argument("<file>", "output typescript file").option("-i, --input <file>", "input action.yaml file", "action.
|
90
|
-
const
|
90
|
+
program.name("generate").description("generate typescript code from action.yaml file").argument("<file>", "output typescript file").option("-i, --input <file>", "input action.yaml file", "action.yaml").option("--watch", "watch mode", false).action(async (file, options) => {
|
91
|
+
const inputFile = (0, import_node_fs.existsSync)(options.input) ? options.input : (0, import_node_fs.existsSync)("action.yaml") ? "action.yaml" : "action.yml";
|
92
|
+
const yaml = (0, import_yaml.parse)(await universalReadFile(inputFile));
|
91
93
|
await (0, import_promises2.mkdir)((0, import_node_path.dirname)(file), { recursive: true });
|
92
94
|
await (0, import_promises2.writeFile)(file, actionToType(yaml));
|
93
95
|
if (!options.watch) {
|
94
96
|
return;
|
95
97
|
}
|
96
|
-
for await (const _ of (0, import_promises2.watch)(
|
97
|
-
const yaml2 = (0, import_yaml.parse)(
|
98
|
-
await universalReadFile(options.input)
|
99
|
-
);
|
98
|
+
for await (const _ of (0, import_promises2.watch)(inputFile)) {
|
99
|
+
const yaml2 = (0, import_yaml.parse)(await universalReadFile(inputFile));
|
100
100
|
await (0, import_promises2.mkdir)((0, import_node_path.dirname)(file), { recursive: true });
|
101
101
|
await (0, import_promises2.writeFile)(file, actionToType(yaml2));
|
102
102
|
console.log("Updated", file);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../src/bin/action-yaml.ts","../../src/action-to-type.ts","../../src/utils.ts"],"sourcesContent":["import { mkdir, watch, writeFile } from \"node:fs/promises\";\nimport { dirname } from \"node:path\";\nimport type { GithubAction } from \"@schemastore/github-action\";\nimport { Command } from \"commander\";\nimport { parse } from \"yaml\";\nimport { actionToType } from \"../action-to-type\";\nimport { universalReadFile } from \"../utils\";\n\nconst program = new Command();\n\nprogram\n .name(\"generate\")\n .description(\"generate typescript code from action.yaml file\")\n .argument(\"<file>\", \"output typescript file\")\n .option(\"-i, --input <file>\", \"input action.yaml file\", \"action.
|
1
|
+
{"version":3,"sources":["../../src/bin/action-yaml.ts","../../src/action-to-type.ts","../../src/utils.ts"],"sourcesContent":["import { existsSync } from \"node:fs\";\nimport { mkdir, watch, writeFile } from \"node:fs/promises\";\nimport { dirname } from \"node:path\";\nimport type { GithubAction } from \"@schemastore/github-action\";\nimport { Command } from \"commander\";\nimport { parse } from \"yaml\";\nimport { actionToType } from \"../action-to-type\";\nimport { universalReadFile } from \"../utils\";\n\nconst program = new Command();\n\nprogram\n .name(\"generate\")\n .description(\"generate typescript code from action.yaml file\")\n .argument(\"<file>\", \"output typescript file\")\n .option(\"-i, --input <file>\", \"input action.yaml file\", \"action.yaml\")\n .option(\"--watch\", \"watch mode\", false)\n .action(async (file: string, options: { input: string; watch: boolean }) => {\n const inputFile = existsSync(options.input)\n ? options.input\n : existsSync(\"action.yaml\")\n ? \"action.yaml\"\n : \"action.yml\";\n const yaml = parse(await universalReadFile(inputFile)) as GithubAction;\n\n await mkdir(dirname(file), { recursive: true });\n await writeFile(file, actionToType(yaml));\n\n if (!options.watch) {\n return;\n }\n\n for await (const _ of watch(inputFile)) {\n const yaml = parse(await universalReadFile(inputFile)) as GithubAction;\n\n await mkdir(dirname(file), { recursive: true });\n await writeFile(file, actionToType(yaml));\n console.log(\"Updated\", file);\n }\n });\n\nprogram.parse();\n","import type { GithubAction } from \"@schemastore/github-action\";\n\nexport const actionToType = (action: GithubAction) => {\n const actionInputs = action.inputs ?? {};\n\n const inputsType = `\\\nexport type Inputs<T extends InputOptions<typeof raw> = InputOptions<typeof raw>, V extends InputsValues<typeof raw, T> = InputsValues<typeof raw,T>> = {\n${Object.entries(actionInputs ?? {})\n .map(\n ([key, value]) => `\\\n /**\n * ${value.description}\n * \n${value.default ? ` * @default ${value.default}\\n` : \"\"}\\\n${value.deprecationMessage ? ` * @deprecated ${value.deprecationMessage}\\n` : \"\"}\\\n */\n '${key}'${value.required || typeof value.default !== \"undefined\" ? \"\" : \"?\"}: V[\"${key}\"];\\\n`,\n )\n .join(\"\\n\")}\n}`;\n\n const outputsType = `\\\nexport type Outputs = {\n${Object.entries(\n (action.outputs as Record<string, { description?: string }>) ?? {},\n)\n .map(\n ([key, value]) => `\\\n /**\n * ${value.description}\n * \n */\n '${key}'?: string;\\\n`,\n )\n .join(\"\\n\")}\n}`;\n\n const parseInputs = `\\\nconst getInput = {\n string: core.getInput,\n boolean: core.getBooleanInput,\n multiline: core.getMultilineInput,\n};\n\nexport const parseInputs = <T extends InputOptions<typeof raw>>(options?: T): Prettify<Inputs<T>> => {\n return {\n${Object.keys(actionInputs ?? {})\n .map(\n (key) =>\n ` \"${key}\": getInput[options?.[\"${key}\"]?.type ?? \"string\"](\"${key}\", {trimWhitespace: options?.cwd?.trimWhitespace}),`,\n )\n .join(\"\\n\")}\n } as Inputs<T>;\n}`;\n\n const dumpOutputs = `\\\nexport const dumpOutputs = (outputs: Partial<Outputs>) => {\n for (const [name, value] of Object.entries(outputs)) {\n core.setOutput(name, value)\n }\n}`;\n\n return `\\\n// @ts-ignore\nimport * as core from \"@github/core\";\nimport { Prettify, InputOptions, InputsValues } from \"github-action-yaml\"\n\nexport const raw = ${JSON.stringify(action, null, 2)} as const;\n\n${inputsType}\n\n${outputsType}\n\n${parseInputs}\n\n${dumpOutputs}\n`;\n};\n","import { readFile } from \"node:fs/promises\";\n\nfunction isUrl(input: string): boolean {\n try {\n const url = new URL(input);\n return url.protocol === \"http:\" || url.protocol === \"https:\";\n } catch {\n return false;\n }\n}\n\nexport const universalReadFile = async (path: string) => {\n if (isUrl(path)) {\n const response = await fetch(path);\n return response.text();\n }\n const file = await readFile(path, \"utf-8\");\n return file;\n};\n"],"mappings":";;;AAAA,qBAA2B;AAC3B,IAAAA,mBAAwC;AACxC,uBAAwB;AAExB,uBAAwB;AACxB,kBAAsB;;;ACHf,IAAM,eAAe,CAAC,WAAyB;AACpD,QAAM,eAAe,OAAO,UAAU,CAAC;AAEvC,QAAM,aAAa;AAAA,EAEnB,OAAO,QAAQ,gBAAgB,CAAC,CAAC,EAChC;AAAA,IACC,CAAC,CAAC,KAAK,KAAK,MAAM;AAAA,OAEf,MAAM,WAAW;AAAA;AAAA,EAEtB,MAAM,UAAU,iBAAiB,MAAM,OAAO;AAAA,IAAO,EAAE,GACvD,MAAM,qBAAqB,oBAAoB,MAAM,kBAAkB;AAAA,IAAO,EAAE;AAAA,KAE7E,GAAG,IAAI,MAAM,YAAY,OAAO,MAAM,YAAY,cAAc,KAAK,GAAG,QAAQ,GAAG;AAAA,EAEtF,EACC,KAAK,IAAI,CAAC;AAAA;AAGX,QAAM,cAAc;AAAA,EAEpB,OAAO;AAAA,IACN,OAAO,WAAwD,CAAC;AAAA,EACnE,EACG;AAAA,IACC,CAAC,CAAC,KAAK,KAAK,MAAM;AAAA,OAEf,MAAM,WAAW;AAAA;AAAA;AAAA,KAGnB,GAAG;AAAA,EAEN,EACC,KAAK,IAAI,CAAC;AAAA;AAGX,QAAM,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASpB,OAAO,KAAK,gBAAgB,CAAC,CAAC,EAC7B;AAAA,IACC,CAAC,QACC,QAAQ,GAAG,0BAA0B,GAAG,0BAA0B,GAAG;AAAA,EACzE,EACC,KAAK,IAAI,CAAC;AAAA;AAAA;AAIX,QAAM,cAAc;AAAA;AAAA;AAAA;AAAA;AAOpB,SAAO;AAAA;AAAA;AAAA;AAAA,qBAKY,KAAK,UAAU,QAAQ,MAAM,CAAC,CAAC;AAA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EH,QAAQ,MAAM;","names":["import_promises","yaml"]}
|
package/dist/bin/action-yaml.js
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
// src/bin/action-yaml.ts
|
2
|
+
import { existsSync } from "node:fs";
|
2
3
|
import { mkdir, watch, writeFile } from "node:fs/promises";
|
3
4
|
import { dirname } from "node:path";
|
4
5
|
import { Command } from "commander";
|
@@ -84,17 +85,16 @@ var universalReadFile = async (path) => {
|
|
84
85
|
|
85
86
|
// src/bin/action-yaml.ts
|
86
87
|
var program = new Command();
|
87
|
-
program.name("generate").description("generate typescript code from action.yaml file").argument("<file>", "output typescript file").option("-i, --input <file>", "input action.yaml file", "action.
|
88
|
-
const
|
88
|
+
program.name("generate").description("generate typescript code from action.yaml file").argument("<file>", "output typescript file").option("-i, --input <file>", "input action.yaml file", "action.yaml").option("--watch", "watch mode", false).action(async (file, options) => {
|
89
|
+
const inputFile = existsSync(options.input) ? options.input : existsSync("action.yaml") ? "action.yaml" : "action.yml";
|
90
|
+
const yaml = parse(await universalReadFile(inputFile));
|
89
91
|
await mkdir(dirname(file), { recursive: true });
|
90
92
|
await writeFile(file, actionToType(yaml));
|
91
93
|
if (!options.watch) {
|
92
94
|
return;
|
93
95
|
}
|
94
|
-
for await (const _ of watch(
|
95
|
-
const yaml2 = parse(
|
96
|
-
await universalReadFile(options.input)
|
97
|
-
);
|
96
|
+
for await (const _ of watch(inputFile)) {
|
97
|
+
const yaml2 = parse(await universalReadFile(inputFile));
|
98
98
|
await mkdir(dirname(file), { recursive: true });
|
99
99
|
await writeFile(file, actionToType(yaml2));
|
100
100
|
console.log("Updated", file);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../src/bin/action-yaml.ts","../../src/action-to-type.ts","../../src/utils.ts"],"sourcesContent":["import { mkdir, watch, writeFile } from \"node:fs/promises\";\nimport { dirname } from \"node:path\";\nimport type { GithubAction } from \"@schemastore/github-action\";\nimport { Command } from \"commander\";\nimport { parse } from \"yaml\";\nimport { actionToType } from \"../action-to-type\";\nimport { universalReadFile } from \"../utils\";\n\nconst program = new Command();\n\nprogram\n .name(\"generate\")\n .description(\"generate typescript code from action.yaml file\")\n .argument(\"<file>\", \"output typescript file\")\n .option(\"-i, --input <file>\", \"input action.yaml file\", \"action.
|
1
|
+
{"version":3,"sources":["../../src/bin/action-yaml.ts","../../src/action-to-type.ts","../../src/utils.ts"],"sourcesContent":["import { existsSync } from \"node:fs\";\nimport { mkdir, watch, writeFile } from \"node:fs/promises\";\nimport { dirname } from \"node:path\";\nimport type { GithubAction } from \"@schemastore/github-action\";\nimport { Command } from \"commander\";\nimport { parse } from \"yaml\";\nimport { actionToType } from \"../action-to-type\";\nimport { universalReadFile } from \"../utils\";\n\nconst program = new Command();\n\nprogram\n .name(\"generate\")\n .description(\"generate typescript code from action.yaml file\")\n .argument(\"<file>\", \"output typescript file\")\n .option(\"-i, --input <file>\", \"input action.yaml file\", \"action.yaml\")\n .option(\"--watch\", \"watch mode\", false)\n .action(async (file: string, options: { input: string; watch: boolean }) => {\n const inputFile = existsSync(options.input)\n ? options.input\n : existsSync(\"action.yaml\")\n ? \"action.yaml\"\n : \"action.yml\";\n const yaml = parse(await universalReadFile(inputFile)) as GithubAction;\n\n await mkdir(dirname(file), { recursive: true });\n await writeFile(file, actionToType(yaml));\n\n if (!options.watch) {\n return;\n }\n\n for await (const _ of watch(inputFile)) {\n const yaml = parse(await universalReadFile(inputFile)) as GithubAction;\n\n await mkdir(dirname(file), { recursive: true });\n await writeFile(file, actionToType(yaml));\n console.log(\"Updated\", file);\n }\n });\n\nprogram.parse();\n","import type { GithubAction } from \"@schemastore/github-action\";\n\nexport const actionToType = (action: GithubAction) => {\n const actionInputs = action.inputs ?? {};\n\n const inputsType = `\\\nexport type Inputs<T extends InputOptions<typeof raw> = InputOptions<typeof raw>, V extends InputsValues<typeof raw, T> = InputsValues<typeof raw,T>> = {\n${Object.entries(actionInputs ?? {})\n .map(\n ([key, value]) => `\\\n /**\n * ${value.description}\n * \n${value.default ? ` * @default ${value.default}\\n` : \"\"}\\\n${value.deprecationMessage ? ` * @deprecated ${value.deprecationMessage}\\n` : \"\"}\\\n */\n '${key}'${value.required || typeof value.default !== \"undefined\" ? \"\" : \"?\"}: V[\"${key}\"];\\\n`,\n )\n .join(\"\\n\")}\n}`;\n\n const outputsType = `\\\nexport type Outputs = {\n${Object.entries(\n (action.outputs as Record<string, { description?: string }>) ?? {},\n)\n .map(\n ([key, value]) => `\\\n /**\n * ${value.description}\n * \n */\n '${key}'?: string;\\\n`,\n )\n .join(\"\\n\")}\n}`;\n\n const parseInputs = `\\\nconst getInput = {\n string: core.getInput,\n boolean: core.getBooleanInput,\n multiline: core.getMultilineInput,\n};\n\nexport const parseInputs = <T extends InputOptions<typeof raw>>(options?: T): Prettify<Inputs<T>> => {\n return {\n${Object.keys(actionInputs ?? {})\n .map(\n (key) =>\n ` \"${key}\": getInput[options?.[\"${key}\"]?.type ?? \"string\"](\"${key}\", {trimWhitespace: options?.cwd?.trimWhitespace}),`,\n )\n .join(\"\\n\")}\n } as Inputs<T>;\n}`;\n\n const dumpOutputs = `\\\nexport const dumpOutputs = (outputs: Partial<Outputs>) => {\n for (const [name, value] of Object.entries(outputs)) {\n core.setOutput(name, value)\n }\n}`;\n\n return `\\\n// @ts-ignore\nimport * as core from \"@github/core\";\nimport { Prettify, InputOptions, InputsValues } from \"github-action-yaml\"\n\nexport const raw = ${JSON.stringify(action, null, 2)} as const;\n\n${inputsType}\n\n${outputsType}\n\n${parseInputs}\n\n${dumpOutputs}\n`;\n};\n","import { readFile } from \"node:fs/promises\";\n\nfunction isUrl(input: string): boolean {\n try {\n const url = new URL(input);\n return url.protocol === \"http:\" || url.protocol === \"https:\";\n } catch {\n return false;\n }\n}\n\nexport const universalReadFile = async (path: string) => {\n if (isUrl(path)) {\n const response = await fetch(path);\n return response.text();\n }\n const file = await readFile(path, \"utf-8\");\n return file;\n};\n"],"mappings":";AAAA,SAAS,kBAAkB;AAC3B,SAAS,OAAO,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"version": "0.0.3",
|
4
4
|
"type": "module",
|
5
5
|
"bin": {
|
6
6
|
"github-action-yaml": "./dist/bin/action-yaml.js"
|
@@ -8,6 +8,10 @@
|
|
8
8
|
"main": "./dist/index.cjs",
|
9
9
|
"module": "./dist/index.js",
|
10
10
|
"types": "./dist/index.d.ts",
|
11
|
+
"files": [
|
12
|
+
"dist",
|
13
|
+
"src"
|
14
|
+
],
|
11
15
|
"keywords": [],
|
12
16
|
"author": "YutaUra",
|
13
17
|
"license": "ISC",
|
package/src/bin/action-yaml.ts
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
import { existsSync } from "node:fs";
|
1
2
|
import { mkdir, watch, writeFile } from "node:fs/promises";
|
2
3
|
import { dirname } from "node:path";
|
3
4
|
import type { GithubAction } from "@schemastore/github-action";
|
@@ -12,10 +13,15 @@ program
|
|
12
13
|
.name("generate")
|
13
14
|
.description("generate typescript code from action.yaml file")
|
14
15
|
.argument("<file>", "output typescript file")
|
15
|
-
.option("-i, --input <file>", "input action.yaml file", "action.
|
16
|
+
.option("-i, --input <file>", "input action.yaml file", "action.yaml")
|
16
17
|
.option("--watch", "watch mode", false)
|
17
18
|
.action(async (file: string, options: { input: string; watch: boolean }) => {
|
18
|
-
const
|
19
|
+
const inputFile = existsSync(options.input)
|
20
|
+
? options.input
|
21
|
+
: existsSync("action.yaml")
|
22
|
+
? "action.yaml"
|
23
|
+
: "action.yml";
|
24
|
+
const yaml = parse(await universalReadFile(inputFile)) as GithubAction;
|
19
25
|
|
20
26
|
await mkdir(dirname(file), { recursive: true });
|
21
27
|
await writeFile(file, actionToType(yaml));
|
@@ -24,10 +30,8 @@ program
|
|
24
30
|
return;
|
25
31
|
}
|
26
32
|
|
27
|
-
for await (const _ of watch(
|
28
|
-
const yaml = parse(
|
29
|
-
await universalReadFile(options.input),
|
30
|
-
) as GithubAction;
|
33
|
+
for await (const _ of watch(inputFile)) {
|
34
|
+
const yaml = parse(await universalReadFile(inputFile)) as GithubAction;
|
31
35
|
|
32
36
|
await mkdir(dirname(file), { recursive: true });
|
33
37
|
await writeFile(file, actionToType(yaml));
|
package/.changeset/README.md
DELETED
@@ -1,8 +0,0 @@
|
|
1
|
-
# Changesets
|
2
|
-
|
3
|
-
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
|
4
|
-
with multi-package repos, or single-package repos to help you version and publish your code. You can
|
5
|
-
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
|
6
|
-
|
7
|
-
We have a quick list of common questions to get you started engaging with this project in
|
8
|
-
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
|
package/.changeset/config.json
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"$schema": "https://unpkg.com/@changesets/config@3.0.3/schema.json",
|
3
|
-
"changelog": "@changesets/cli/changelog",
|
4
|
-
"commit": false,
|
5
|
-
"fixed": [],
|
6
|
-
"linked": [],
|
7
|
-
"access": "restricted",
|
8
|
-
"baseBranch": "main",
|
9
|
-
"updateInternalDependencies": "patch",
|
10
|
-
"ignore": []
|
11
|
-
}
|
package/.github/CODEOWNERS
DELETED
package/.github/FUNDING.yml
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
# These are supported funding model platforms
|
2
|
-
|
3
|
-
github: [YutaUra] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
4
|
-
patreon: # Replace with a single Patreon username
|
5
|
-
open_collective: # Replace with a single Open Collective username
|
6
|
-
ko_fi: # Replace with a single Ko-fi username
|
7
|
-
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
8
|
-
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
9
|
-
liberapay: # Replace with a single Liberapay username
|
10
|
-
issuehunt: # Replace with a single IssueHunt username
|
11
|
-
otechie: # Replace with a single Otechie username
|
12
|
-
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
|
13
|
-
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
@@ -1,32 +0,0 @@
|
|
1
|
-
name: Setup
|
2
|
-
|
3
|
-
description: |
|
4
|
-
setup fot github actions
|
5
|
-
|
6
|
-
inputs:
|
7
|
-
token:
|
8
|
-
description: The token to use for the setup.
|
9
|
-
required: true
|
10
|
-
bot-app-slug:
|
11
|
-
description: The app slug for the bot.
|
12
|
-
required: true
|
13
|
-
|
14
|
-
runs:
|
15
|
-
using: composite
|
16
|
-
steps:
|
17
|
-
- name: Setup Git User
|
18
|
-
shell: bash
|
19
|
-
run: |
|
20
|
-
user_name=${{ inputs.bot-app-slug }}[bot]
|
21
|
-
user_email=$(gh api "/users/${{ inputs.bot-app-slug }}[bot]" --jq .id)+${{ inputs.bot-app-slug }}[bot]@users.noreply.github.com
|
22
|
-
echo "Setting up git user: $user_name <$user_email>"
|
23
|
-
git config --global user.name $user_name
|
24
|
-
git config --global user.email $user_email
|
25
|
-
env:
|
26
|
-
GH_TOKEN: ${{ inputs.token }}
|
27
|
-
- uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4
|
28
|
-
with:
|
29
|
-
node-version-file: .node-version
|
30
|
-
- name: Setup pnpm
|
31
|
-
shell: bash
|
32
|
-
run: corepack enable pnpm
|
package/.github/renovate.json
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"extends": ["github>yutaura/renovate-oss-base"],
|
3
|
-
"gitIgnoredAuthors": [
|
4
|
-
"github-actions[bot]@users.noreply.github.com",
|
5
|
-
"41898282+github-actions[bot]@users.noreply.github.com",
|
6
|
-
"yutaura-bot[bot]@users.noreply.github.com",
|
7
|
-
"179370226+yutaura-bot[bot]@users.noreply.github.com"
|
8
|
-
]
|
9
|
-
}
|
@@ -1,29 +0,0 @@
|
|
1
|
-
name: create changeset for PR created by Renovate
|
2
|
-
|
3
|
-
on:
|
4
|
-
pull_request:
|
5
|
-
branches:
|
6
|
-
- main
|
7
|
-
|
8
|
-
jobs:
|
9
|
-
default:
|
10
|
-
runs-on: ubuntu-latest
|
11
|
-
# commit author should be renovate[bot]
|
12
|
-
if: startsWith(github.head_ref, 'renovate/') && github.event.pull_request.user.login == 'renovate[bot]' && github.actor == 'renovate[bot]'
|
13
|
-
steps:
|
14
|
-
- uses: actions/create-github-app-token@5d869da34e18e7287c1daad50e0b8ea0f506ce69 # v1.11.0
|
15
|
-
id: app-token
|
16
|
-
with:
|
17
|
-
app-id: ${{ secrets.BOT_APP_ID }}
|
18
|
-
private-key: ${{ secrets.BOT_PRIVATE_KEY }}
|
19
|
-
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
|
20
|
-
with:
|
21
|
-
token: ${{ steps.app-token.outputs.token }}
|
22
|
-
- uses: ./.github/actions/setup
|
23
|
-
with:
|
24
|
-
token: ${{ steps.app-token.outputs.token }}
|
25
|
-
bot-app-slug: ${{ steps.app-token.outputs.app-slug }}
|
26
|
-
- uses: YutaUra/actions/renovate-changeset@7b5494b1dbff5ee9b4dd4610ee3daf807b473149 # v0.0.5
|
27
|
-
with:
|
28
|
-
token: ${{ steps.app-token.outputs.token }}
|
29
|
-
setup-git-user: false
|
@@ -1,43 +0,0 @@
|
|
1
|
-
name: check_PR
|
2
|
-
|
3
|
-
on:
|
4
|
-
pull_request:
|
5
|
-
branches:
|
6
|
-
- main
|
7
|
-
push:
|
8
|
-
branches:
|
9
|
-
- main
|
10
|
-
|
11
|
-
concurrency:
|
12
|
-
group: ${{ github.workflow }}-${{ github.ref }}
|
13
|
-
cancel-in-progress: true
|
14
|
-
|
15
|
-
jobs:
|
16
|
-
check-pr:
|
17
|
-
runs-on: ubuntu-latest
|
18
|
-
steps:
|
19
|
-
- uses: actions/create-github-app-token@5d869da34e18e7287c1daad50e0b8ea0f506ce69 # v1.11.0
|
20
|
-
id: app-token
|
21
|
-
with:
|
22
|
-
app-id: ${{ secrets.BOT_APP_ID }}
|
23
|
-
private-key: ${{ secrets.BOT_PRIVATE_KEY }}
|
24
|
-
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
|
25
|
-
with:
|
26
|
-
token: ${{ steps.app-token.outputs.token }}
|
27
|
-
- uses: ./.github/actions/setup
|
28
|
-
with:
|
29
|
-
token: ${{ steps.app-token.outputs.token }}
|
30
|
-
bot-app-slug: ${{ steps.app-token.outputs.app-slug }}
|
31
|
-
|
32
|
-
- uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 # v4.4.0
|
33
|
-
with:
|
34
|
-
distribution: "temurin"
|
35
|
-
java-version: "17"
|
36
|
-
|
37
|
-
- run: pnpm install
|
38
|
-
- run: pnpm exec biome check --fix
|
39
|
-
|
40
|
-
- uses: int128/update-generated-files-action@757376506709ed3d87f14a80ca28a98736d52236 # v2.55.0
|
41
|
-
if: always()
|
42
|
-
with:
|
43
|
-
token: ${{ steps.app-token.outputs.token }}
|
@@ -1,56 +0,0 @@
|
|
1
|
-
name: release
|
2
|
-
|
3
|
-
on:
|
4
|
-
push:
|
5
|
-
branches:
|
6
|
-
- main
|
7
|
-
pull_request:
|
8
|
-
branches:
|
9
|
-
- main
|
10
|
-
paths:
|
11
|
-
- .github/workflows/release.yml
|
12
|
-
- .github/actions/setup/**
|
13
|
-
|
14
|
-
concurrency: ${{ github.workflow }}-${{ github.ref }}
|
15
|
-
|
16
|
-
permissions:
|
17
|
-
contents: write
|
18
|
-
pull-requests: write
|
19
|
-
|
20
|
-
jobs:
|
21
|
-
release:
|
22
|
-
name: Release
|
23
|
-
runs-on: ubuntu-latest
|
24
|
-
steps:
|
25
|
-
- uses: actions/create-github-app-token@5d869da34e18e7287c1daad50e0b8ea0f506ce69 # v1.11.0
|
26
|
-
id: app-token
|
27
|
-
with:
|
28
|
-
app-id: ${{ secrets.BOT_APP_ID }}
|
29
|
-
private-key: ${{ secrets.BOT_PRIVATE_KEY }}
|
30
|
-
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
|
31
|
-
with:
|
32
|
-
token: ${{ steps.app-token.outputs.token }}
|
33
|
-
- uses: ./.github/actions/setup
|
34
|
-
with:
|
35
|
-
token: ${{ steps.app-token.outputs.token }}
|
36
|
-
bot-app-slug: ${{ steps.app-token.outputs.app-slug }}
|
37
|
-
|
38
|
-
- name: Install Dependencies
|
39
|
-
run: pnpm install
|
40
|
-
|
41
|
-
- name: Create Release Pull Request or Publish to npm
|
42
|
-
id: changesets
|
43
|
-
if: github.event_name == 'push'
|
44
|
-
uses: changesets/action@v1
|
45
|
-
with:
|
46
|
-
# This expects you to have a script called release which does a build for your packages and calls changeset publish
|
47
|
-
publish: pnpm publish
|
48
|
-
setupGitUser: false
|
49
|
-
env:
|
50
|
-
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
|
51
|
-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
52
|
-
|
53
|
-
- if: ${{ steps.changesets.outputs.pullRequestNumber != '' }}
|
54
|
-
run: gh pr merge --merge --auto "${{ steps.changesets.outputs.pullRequestNumber}}"
|
55
|
-
env:
|
56
|
-
GH_TOKEN: ${{ steps.app-token.outputs.token }}
|
@@ -1,18 +0,0 @@
|
|
1
|
-
name: wait-for-workflows
|
2
|
-
|
3
|
-
on:
|
4
|
-
pull_request:
|
5
|
-
|
6
|
-
jobs:
|
7
|
-
wait-for-workflows:
|
8
|
-
runs-on: ubuntu-latest
|
9
|
-
timeout-minutes: 30
|
10
|
-
steps:
|
11
|
-
- uses: actions/create-github-app-token@5d869da34e18e7287c1daad50e0b8ea0f506ce69 # v1.11.0
|
12
|
-
id: app-token
|
13
|
-
with:
|
14
|
-
app-id: ${{ secrets.BOT_APP_ID }}
|
15
|
-
private-key: ${{ secrets.BOT_PRIVATE_KEY }}
|
16
|
-
- uses: int128/wait-for-workflows-action@a1d37b9f6c1b3a092780ec646297224afc9faf5a # v1.26.0
|
17
|
-
with:
|
18
|
-
token: ${{ steps.app-token.outputs.token }}
|
package/.node-version
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
20.18.0
|
package/CHANGELOG.md
DELETED
package/biome.json
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
|
3
|
-
"vcs": {
|
4
|
-
"enabled": true,
|
5
|
-
"clientKind": "git",
|
6
|
-
"useIgnoreFile": true
|
7
|
-
},
|
8
|
-
"formatter": {
|
9
|
-
"enabled": true,
|
10
|
-
"indentStyle": "space"
|
11
|
-
},
|
12
|
-
"organizeImports": {
|
13
|
-
"enabled": true
|
14
|
-
},
|
15
|
-
"linter": {
|
16
|
-
"enabled": true,
|
17
|
-
"rules": {
|
18
|
-
"recommended": true
|
19
|
-
}
|
20
|
-
},
|
21
|
-
"javascript": {
|
22
|
-
"formatter": {
|
23
|
-
"quoteStyle": "double"
|
24
|
-
}
|
25
|
-
},
|
26
|
-
"files": {
|
27
|
-
"ignore": ["generated/**"]
|
28
|
-
}
|
29
|
-
}
|
package/tsconfig.json
DELETED