Skip to content

Commit 727b8d0

Browse files
committed
chore: Add build-workflow job to ci workflow
1 parent 505208f commit 727b8d0

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

.github/workflows/ci.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,33 @@ workflow.addJob(
1717
}).run("bun test"),
1818
);
1919

20+
workflow.addJob(
21+
setupJob("build-workflow", {
22+
permissions: { contents: "read" },
23+
timeoutMinutes: 5,
24+
withBun: true,
25+
})
26+
.run(`
27+
cat <<EOF > ./.github/workflows/example.ts
28+
import { Workflow, Job } from "ghats";
29+
30+
const workflow = new Workflow("Hello", {
31+
on: "push",
32+
});
33+
34+
workflow.addJob(
35+
new Job("hello", {
36+
runsOn: "ubuntu-latest",
37+
})
38+
.uses("actions/checkout@v4")
39+
.run("echo 'Hello, world!'"),
40+
);
41+
42+
export default workflow;
43+
EOF
44+
`)
45+
.run("bun run ./lib/cli/index.ts build")
46+
.run("cat ./.github/workflows/example.yml"),
47+
);
48+
2049
export default workflow;

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# DO NOT EDIT THIS FILE
22
# This file is automatically generated by ghats (https://www.npmjs.com/package/ghats)
33
# Edit the workflow in .github/workflows/ci.ts instead, and run `ghats build` to update this file.
4-
{"name":"CI","on":{"pull_request":{"branches":["main"]},"push":{"branches":["main"]}},"permissions":{},"jobs":{"test":{"runs-on":"ubuntu-latest","permissions":{"contents":"read"},"timeout-minutes":5,"steps":[{"with":{"persist-credentials":"false"},"uses":"actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683"},{"uses":"jdx/mise-action@5083fe46898c414b2475087cc79da59e7da859e8"},{"with":{"path":"~/.bun/install/cache","key":"${{ runner.os }}-bun-${{ hashFiles('**/bun.lock') }}","restore-keys":"${{ runner.os }}-bun-"},"uses":"actions/cache@5a3ec84eff668545956fd18022155c47e93e2684"},{"run":"bun install --frozen-lockfile"},{"run":"bun test"}]}}}
4+
{"name":"CI","on":{"pull_request":{"branches":["main"]},"push":{"branches":["main"]}},"permissions":{},"jobs":{"test":{"runs-on":"ubuntu-latest","permissions":{"contents":"read"},"timeout-minutes":5,"steps":[{"with":{"persist-credentials":"false"},"uses":"actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683"},{"uses":"jdx/mise-action@5083fe46898c414b2475087cc79da59e7da859e8"},{"with":{"path":"~/.bun/install/cache","key":"${{ runner.os }}-bun-${{ hashFiles('**/bun.lock') }}","restore-keys":"${{ runner.os }}-bun-"},"uses":"actions/cache@5a3ec84eff668545956fd18022155c47e93e2684"},{"run":"bun install --frozen-lockfile"},{"run":"bun test"}]},"build-workflow":{"runs-on":"ubuntu-latest","permissions":{"contents":"read"},"timeout-minutes":5,"steps":[{"with":{"persist-credentials":"false"},"uses":"actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683"},{"uses":"jdx/mise-action@5083fe46898c414b2475087cc79da59e7da859e8"},{"with":{"path":"~/.bun/install/cache","key":"${{ runner.os }}-bun-${{ hashFiles('**/bun.lock') }}","restore-keys":"${{ runner.os }}-bun-"},"uses":"actions/cache@5a3ec84eff668545956fd18022155c47e93e2684"},{"run":"bun install --frozen-lockfile"},{"run":"\ncat <<EOF > ./.github/workflows/example.ts\nimport { Workflow, Job } from \"ghats\";\n\nconst workflow = new Workflow(\"Hello\", {\n on: \"push\",\n});\n\nworkflow.addJob(\n new Job(\"hello\", {\n runsOn: \"ubuntu-latest\",\n })\n .uses(\"actions/checkout@v4\")\n .run(\"echo 'Hello, world!'\"),\n);\n\nexport default workflow;\nEOF\n"},{"run":"bun run ./lib/cli/index.ts build"},{"run":"cat ./.github/workflows/example.yml"}]}}}

0 commit comments

Comments
 (0)