Skip to content

Commit b2efbe7

Browse files
authored
try this
1 parent 8700bff commit b2efbe7

File tree

5 files changed

+50
-9
lines changed

5 files changed

+50
-9
lines changed

.github/workflows/test-action.yml

Lines changed: 45 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ concurrency:
1919
group: ${{ github.workflow }}-${{ github.ref }}
2020
cancel-in-progress: true
2121
jobs:
22-
test-action:
22+
branch:
2323
permissions:
2424
contents: write
2525
strategy:
@@ -33,23 +33,63 @@ jobs:
3333
shell: bash
3434
steps:
3535
- uses: actions/checkout@v4
36+
- uses: oven-sh/setup-bun@v1
37+
- run: bun install
38+
# - run: bun run build
39+
- uses: jcbhmr/[email protected]
40+
- uses: actions/checkout@v4
41+
with:
42+
ref: test-branch
43+
path: test/branch
44+
- shell: bun {0}
45+
run: |
46+
import { readFile, writeFile } from "node:fs/promises";
47+
let number = JSON.parse(await readFile("number.txt", "utf8"))
48+
console.log("old number", number)
49+
number = Math.random();
50+
console.log("new number", number)
51+
await writeFile("number.txt", JSON.stringify(number))
52+
working-directory: test/branch
53+
- id: main
54+
uses: ./
3655
with:
37-
ref: ${{ github.ref }}
56+
path: test/branch
57+
- shell: jq -C . {0}
58+
run: ${{ toJSON(steps.main.outputs) }}
59+
tag:
60+
permissions:
61+
contents: write
62+
strategy:
63+
max-parallel: 1
64+
fail-fast: false
65+
matrix:
66+
os: [ubuntu-latest, macos-latest]
67+
runs-on: ${{ matrix.os }}
68+
defaults:
69+
run:
70+
shell: bash
71+
steps:
72+
- uses: actions/checkout@v4
3873
- uses: oven-sh/setup-bun@v1
3974
- run: bun install
4075
# - run: bun run build
4176
- uses: jcbhmr/[email protected]
77+
- uses: actions/checkout@v4
78+
with:
79+
ref: test-tag
80+
path: test/tag
4281
- shell: bun {0}
4382
run: |
4483
import { readFile, writeFile } from "node:fs/promises";
45-
let number = JSON.parse(await readFile("test/number.txt", "utf8"))
84+
let number = JSON.parse(await readFile("number.txt", "utf8"))
4685
console.log("old number", number)
4786
number = Math.random();
4887
console.log("new number", number)
49-
await writeFile("test/number.txt", JSON.stringify(number))
88+
await writeFile("number.txt", JSON.stringify(number))
89+
working-directory: test/tag
5090
- id: main
5191
uses: ./
5292
with:
53-
add-pathspec: test/number.txt
93+
path: test/tag
5494
- shell: jq -C . {0}
5595
run: ${{ toJSON(steps.main.outputs) }}

action.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ branding:
66
color: blue
77

88
inputs:
9+
path:
10+
default: .
911
add-pathspec: {}
1012
add-force:
1113
default: false

src/main.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { $ } from "./lib/execa.ts";
44
import assert from "node:assert/strict";
55
import { resolve, join } from "node:path";
66

7-
const rootPath = resolve(".");
7+
const rootPath = resolve(core.getInput("path"));
88

99
let addPathspec: string[] | undefined;
1010
if (core.getInput("add-pathspec")) {
@@ -46,8 +46,6 @@ const commitMessage = core.getInput("commit-message");
4646

4747
const pushRepository = core.getInput("push-repository");
4848

49-
console.log("ok done with most of the inputs moving to add commit push");
50-
5149
if (addPathspec) {
5250
await $({
5351
stdio: "inherit",

test/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
https://github.com/actions4git/add-commit-push/tree/test-branch
2+
https://github.com/actions4git/add-commit-push/tree/test-tag

test/number.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)