Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using env.runner_temp instead of home directory to write json file #59

Merged
merged 4 commits into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Use this action to convert issues into a unified JSON structure. Read the [Codel
with:
template-path: .github/ISSUE_TEMPLATE/bug-report.yml # optional but recommended

- run: cat ${HOME}/issue-parser-result.json
- run: cat ${{ runner.temp }}/issue-parser-result.json
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be considered a breaking change (v4) since it changes the behavior of the action.

Copy link
Contributor Author

@joshjohanning joshjohanning Jun 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could definitely see that. Maybe there should have been an output variable instead of a hardcoded path. And the implications of changing that path might have affected some people. Apologies!


- run: echo $FAVORITE_DISH
env:
Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ async function run(env, body, fs, core) {
}

fs.writeFileSync(
`${env.USERPROFILE || env.HOME}/issue-parser-result.json`,
`${env.RUNNER_TEMP}/issue-parser-result.json`,
jsonStringify(result),
"utf-8"
);
Expand Down
16 changes: 8 additions & 8 deletions test.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ it("readme example", () => {

// mock ENV
const env = {
HOME: "<home path>",
RUNNER_TEMP: "<runner_temp path>",
};

// mock event payload
Expand All @@ -27,7 +27,7 @@ it("readme example", () => {
return readFileSync("fixtures/readme-example/form.yml", "utf-8");
},
writeFileSync(path, content) {
expect(path).toBe("<home path>/issue-parser-result.json");
expect(path).toBe("<runner_temp path>/issue-parser-result.json");
expect(content).toBe(expectedOutputJson);
},
};
Expand All @@ -52,7 +52,7 @@ it("full example", () => {

// mock ENV
const env = {
HOME: "<home path>",
RUNNER_TEMP: "<runner_temp path>",
};

// mock event payload
Expand All @@ -66,7 +66,7 @@ it("full example", () => {
return readFileSync("fixtures/full-example/form.yml", "utf-8");
},
writeFileSync(path, content) {
expect(path).toBe("<home path>/issue-parser-result.json");
expect(path).toBe("<runner_temp path>/issue-parser-result.json");
expect(content).toBe(expectedOutputJson);
},
};
Expand Down Expand Up @@ -96,7 +96,7 @@ it("multiple paragraphs", () => {

// mock ENV
const env = {
HOME: "<home path>",
RUNNER_TEMP: "<runner_temp path>",
};

// mock event payload
Expand All @@ -110,7 +110,7 @@ it("multiple paragraphs", () => {
return readFileSync("fixtures/multiple-paragraphs/form.yml", "utf-8");
},
writeFileSync(path, content) {
expect(path).toBe("<home path>/issue-parser-result.json");
expect(path).toBe("<runner_temp path>/issue-parser-result.json");
expect(content).toBe(expectedOutputJson);
},
};
Expand All @@ -136,7 +136,7 @@ it("blank", () => {

// mock ENV
const env = {
HOME: "<home path>",
RUNNER_TEMP: "<runner_temp path>",
};

// mock event payload
Expand All @@ -150,7 +150,7 @@ it("blank", () => {
return readFileSync("fixtures/blank/form.yml", "utf-8");
},
writeFileSync(path, content) {
expect(path).toBe("<home path>/issue-parser-result.json");
expect(path).toBe("<runner_temp path>/issue-parser-result.json");
expect(content).toBe(expectedOutputJson);
},
};
Expand Down
Loading