Skip to content

Commit

Permalink
fix: enable paths in usage
Browse files Browse the repository at this point in the history
  • Loading branch information
glungley committed Sep 3, 2024
1 parent 5f01ac1 commit fbb6b9a
Show file tree
Hide file tree
Showing 18 changed files with 24 additions and 21 deletions.
2 changes: 1 addition & 1 deletion __tests__/fixtures/action/action_deprecated.output
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Default test
### Usage

```yaml
- uses: npalm/action-docs@v1
- uses: npalm/action-docs/__tests__/fixtures/action/all_fields_action.yml@v1
with:
inputA:
# A description A
Expand Down
2 changes: 1 addition & 1 deletion __tests__/fixtures/action/action_usage_readme.output
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
## Usage

```yaml
- uses: npalm/action-docs@v1
- uses: npalm/action-docs/__tests__/fixtures/action/action.yml@v1
with:
inputA:
# - Item 1
Expand Down
2 changes: 1 addition & 1 deletion __tests__/fixtures/action/all_fields_action.output
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ This action is a `node12` action.
## Usage

```yaml
- uses: ***PROJECT***@***VERSION***
- uses: ***PROJECT******SOURCE_FILE***@***VERSION***
with:
inputA:
# A description A
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ This action is a `node12` action.
### Usage

```yaml
- uses: ***PROJECT***@***VERSION***
- uses: ***PROJECT******SOURCE_FILE***@***VERSION***
with:
inputA:
# A description A
Expand Down
2 changes: 1 addition & 1 deletion __tests__/fixtures/action/all_fields_one_annotation.output
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ This action is a `node12` action.
## Usage

```yaml
- uses: npalm/action-docs@v1
- uses: npalm/action-docs/__tests__/fixtures/action/all_fields_action.yml@v1
with:
inputA:
# A description A
Expand Down
2 changes: 1 addition & 1 deletion __tests__/fixtures/action/all_fields_readme.output
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Default test
### Usage

```yaml
- uses: npalm/action-docs@v1
- uses: npalm/action-docs/__tests__/fixtures/action/all_fields_action.yml@v1
with:
inputA:
# A description A
Expand Down
2 changes: 1 addition & 1 deletion __tests__/fixtures/action/all_fields_usage_readme.output
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
## Usage

```yaml
- uses: npalm/action-docs@v1
- uses: npalm/action-docs/__tests__/fixtures/action/all_fields_action.yml@v1
with:
inputA:
# A description A
Expand Down
2 changes: 1 addition & 1 deletion __tests__/fixtures/action/default-with-header.output
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ This action is a `node12` action.
### Usage

```yaml
- uses: ***PROJECT***@***VERSION***
- uses: ***PROJECT******SOURCE_FILE***@***VERSION***
with:
inputA:
# - Item 1
Expand Down
2 changes: 1 addition & 1 deletion __tests__/fixtures/action/default.output
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ This action is a `node12` action.
## Usage

```yaml
- uses: ***PROJECT***@***VERSION***
- uses: ***PROJECT******SOURCE_FILE***@***VERSION***
with:
inputA:
# - Item 1
Expand Down
2 changes: 1 addition & 1 deletion __tests__/fixtures/action/minimal_action.output
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This action is a `docker` action.
## Usage

```yaml
- uses: ***PROJECT***@***VERSION***
- uses: ***PROJECT******SOURCE_FILE***@***VERSION***
```


Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
```yaml
jobs:
job1:
uses: npalm/action-docs@v1
uses: npalm/action-docs/__tests__/fixtures/workflow/all_fields_workflow.yml@v1
with:
inputA:
# A description A
Expand Down
2 changes: 1 addition & 1 deletion __tests__/fixtures/workflow/all_fields_readme.output
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
```yaml
jobs:
job1:
uses: npalm/action-docs@v1
uses: npalm/action-docs/__tests__/fixtures/workflow/all_fields_workflow.yml@v1
with:
inputA:
# A description A
Expand Down
2 changes: 1 addition & 1 deletion __tests__/fixtures/workflow/all_fields_usage_readme.output
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
```yaml
jobs:
job1:
uses: npalm/action-docs@v1
uses: npalm/action-docs/__tests__/fixtures/workflow/all_fields_workflow.yml@v1
with:
inputA:
# A description A
Expand Down
2 changes: 1 addition & 1 deletion __tests__/fixtures/workflow/all_fields_workflow.output
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
```yaml
jobs:
job1:
uses: ***PROJECT***@***VERSION***
uses: ***PROJECT******SOURCE_FILE***@***VERSION***
with:
inputA:
# A description A
Expand Down
2 changes: 1 addition & 1 deletion __tests__/fixtures/workflow/default.output
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
```yaml
jobs:
job1:
uses: ***PROJECT***@***VERSION***
uses: ***PROJECT******SOURCE_FILE***@***VERSION***
with:
inputA:
# - Item 1
Expand Down
2 changes: 1 addition & 1 deletion __tests__/fixtures/workflow/minimal_workflow.output
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
```yaml
jobs:
job1:
uses: ***PROJECT***@***VERSION***
uses: ***PROJECT******SOURCE_FILE***@***VERSION***
```


2 changes: 1 addition & 1 deletion __tests__/fixtures/workflow/workflow_usage_readme.output
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
```yaml
jobs:
job1:
uses: npalm/action-docs@v1
uses: npalm/action-docs/__tests__/fixtures/workflow/workflow.yml@v1
with:
inputA:
# - Item 1
Expand Down
11 changes: 7 additions & 4 deletions src/action-docs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,14 @@ function createMdCodeBlock(
let indent = "";

if (isAction) {
codeBlockArray.push("- uses: ***PROJECT***@***VERSION***");
codeBlockArray.push("- uses: ***PROJECT******SOURCE_FILE***@***VERSION***");
indent += " ";
} else {
codeBlockArray.push("jobs:");
indent += " ";
codeBlockArray.push(`${indent}job1:`);
indent += " ";
codeBlockArray.push(`${indent}uses: ***PROJECT***@***VERSION***`);
codeBlockArray.push(`${indent}uses: ***PROJECT******SOURCE_FILE***@***VERSION***`);
}

const inputs = getInputOutput(
Expand Down Expand Up @@ -352,6 +352,9 @@ async function updateReadme(
.replace(
"***VERSION***",
matchProjectVersion ? matchProjectVersion[2] : "",
).replace(
"***SOURCE_FILE***",
sourceFile !== defaultOptions.sourceFile ? `/${sourceFile}` : "",
);

await replaceInFile.replaceInFile({
Expand All @@ -377,8 +380,8 @@ function createMarkdownSection(
return data === "" || data === undefined
? ""
: `${createMarkdownHeader(options, header)}${data}` +
`${lineBreak}` +
`${lineBreak}`;
`${lineBreak}` +
`${lineBreak}`;
}

function createMarkdownHeader(options: DefaultOptions, header: string): string {
Expand Down

0 comments on commit fbb6b9a

Please sign in to comment.