Skip to content

Commit d67339e

Browse files
committed
fix: enable paths in usage
1 parent bf8725c commit d67339e

18 files changed

+24
-21
lines changed

__tests__/fixtures/action/action_deprecated.output

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Default test
1212
### Usage
1313

1414
```yaml
15-
- uses: npalm/action-docs@v1
15+
- uses: npalm/action-docs/__tests__/fixtures/action/all_fields_action.yml@v1
1616
with:
1717
inputA:
1818
# A description A

__tests__/fixtures/action/action_usage_readme.output

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
## Usage
33

44
```yaml
5-
- uses: npalm/action-docs@v1
5+
- uses: npalm/action-docs/__tests__/fixtures/action/action.yml@v1
66
with:
77
inputA:
88
# - Item 1

__tests__/fixtures/action/all_fields_action.output

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ This action is a `node12` action.
2828
## Usage
2929

3030
```yaml
31-
- uses: ***PROJECT***@***VERSION***
31+
- uses: ***PROJECT******SOURCE_FILE***@***VERSION***
3232
with:
3333
inputA:
3434
# A description A

__tests__/fixtures/action/all_fields_action_toc3_cli.output

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ This action is a `node12` action.
2828
### Usage
2929

3030
```yaml
31-
- uses: ***PROJECT***@***VERSION***
31+
- uses: ***PROJECT******SOURCE_FILE***@***VERSION***
3232
with:
3333
inputA:
3434
# A description A

__tests__/fixtures/action/all_fields_one_annotation.output

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ This action is a `node12` action.
2929
## Usage
3030

3131
```yaml
32-
- uses: npalm/action-docs@v1
32+
- uses: npalm/action-docs/__tests__/fixtures/action/all_fields_action.yml@v1
3333
with:
3434
inputA:
3535
# A description A

__tests__/fixtures/action/all_fields_readme.output

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Default test
1212
### Usage
1313

1414
```yaml
15-
- uses: npalm/action-docs@v1
15+
- uses: npalm/action-docs/__tests__/fixtures/action/all_fields_action.yml@v1
1616
with:
1717
inputA:
1818
# A description A

__tests__/fixtures/action/all_fields_usage_readme.output

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
## Usage
33

44
```yaml
5-
- uses: npalm/action-docs@v1
5+
- uses: npalm/action-docs/__tests__/fixtures/action/all_fields_action.yml@v1
66
with:
77
inputA:
88
# A description A

__tests__/fixtures/action/default-with-header.output

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ This action is a `node12` action.
2626
### Usage
2727

2828
```yaml
29-
- uses: ***PROJECT***@***VERSION***
29+
- uses: ***PROJECT******SOURCE_FILE***@***VERSION***
3030
with:
3131
inputA:
3232
# - Item 1

__tests__/fixtures/action/default.output

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ This action is a `node12` action.
2424
## Usage
2525

2626
```yaml
27-
- uses: ***PROJECT***@***VERSION***
27+
- uses: ***PROJECT******SOURCE_FILE***@***VERSION***
2828
with:
2929
inputA:
3030
# - Item 1

__tests__/fixtures/action/minimal_action.output

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ This action is a `docker` action.
99
## Usage
1010

1111
```yaml
12-
- uses: ***PROJECT***@***VERSION***
12+
- uses: ***PROJECT******SOURCE_FILE***@***VERSION***
1313
```
1414

1515

__tests__/fixtures/workflow/all_fields_one_annotation.output

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
```yaml
2626
jobs:
2727
job1:
28-
uses: npalm/action-docs@v1
28+
uses: npalm/action-docs/__tests__/fixtures/workflow/all_fields_workflow.yml@v1
2929
with:
3030
inputA:
3131
# A description A

__tests__/fixtures/workflow/all_fields_readme.output

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
```yaml
99
jobs:
1010
job1:
11-
uses: npalm/action-docs@v1
11+
uses: npalm/action-docs/__tests__/fixtures/workflow/all_fields_workflow.yml@v1
1212
with:
1313
inputA:
1414
# A description A

__tests__/fixtures/workflow/all_fields_usage_readme.output

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
```yaml
55
jobs:
66
job1:
7-
uses: npalm/action-docs@v1
7+
uses: npalm/action-docs/__tests__/fixtures/workflow/all_fields_workflow.yml@v1
88
with:
99
inputA:
1010
# A description A

__tests__/fixtures/workflow/all_fields_workflow.output

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
```yaml
2525
jobs:
2626
job1:
27-
uses: ***PROJECT***@***VERSION***
27+
uses: ***PROJECT******SOURCE_FILE***@***VERSION***
2828
with:
2929
inputA:
3030
# A description A

__tests__/fixtures/workflow/default.output

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
```yaml
2121
jobs:
2222
job1:
23-
uses: ***PROJECT***@***VERSION***
23+
uses: ***PROJECT******SOURCE_FILE***@***VERSION***
2424
with:
2525
inputA:
2626
# - Item 1

__tests__/fixtures/workflow/minimal_workflow.output

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
```yaml
66
jobs:
77
job1:
8-
uses: ***PROJECT***@***VERSION***
8+
uses: ***PROJECT******SOURCE_FILE***@***VERSION***
99
```
1010

1111

__tests__/fixtures/workflow/workflow_usage_readme.output

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
```yaml
55
jobs:
66
job1:
7-
uses: npalm/action-docs@v1
7+
uses: npalm/action-docs/__tests__/fixtures/workflow/workflow.yml@v1
88
with:
99
inputA:
1010
# - Item 1

src/action-docs.ts

+7-4
Original file line numberDiff line numberDiff line change
@@ -125,14 +125,14 @@ function createMdCodeBlock(
125125
let indent = "";
126126

127127
if (isAction) {
128-
codeBlockArray.push("- uses: ***PROJECT***@***VERSION***");
128+
codeBlockArray.push("- uses: ***PROJECT******SOURCE_FILE***@***VERSION***");
129129
indent += " ";
130130
} else {
131131
codeBlockArray.push("jobs:");
132132
indent += " ";
133133
codeBlockArray.push(`${indent}job1:`);
134134
indent += " ";
135-
codeBlockArray.push(`${indent}uses: ***PROJECT***@***VERSION***`);
135+
codeBlockArray.push(`${indent}uses: ***PROJECT******SOURCE_FILE***@***VERSION***`);
136136
}
137137

138138
const inputs = getInputOutput(
@@ -352,6 +352,9 @@ async function updateReadme(
352352
.replace(
353353
"***VERSION***",
354354
matchProjectVersion ? matchProjectVersion[2] : "",
355+
).replace(
356+
"***SOURCE_FILE***",
357+
sourceFile !== defaultOptions.sourceFile ? `/${sourceFile}` : "",
355358
);
356359

357360
await replaceInFile.replaceInFile({
@@ -377,8 +380,8 @@ function createMarkdownSection(
377380
return data === "" || data === undefined
378381
? ""
379382
: `${createMarkdownHeader(options, header)}${data}` +
380-
`${lineBreak}` +
381-
`${lineBreak}`;
383+
`${lineBreak}` +
384+
`${lineBreak}`;
382385
}
383386

384387
function createMarkdownHeader(options: DefaultOptions, header: string): string {

0 commit comments

Comments
 (0)