Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
- fix .upmconfig.toml file access
  • Loading branch information
StephenHodgson authored Aug 15, 2024
1 parent 0474800 commit 7df97b9
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 10 deletions.
11 changes: 8 additions & 3 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26238,9 +26238,14 @@ async function save_upm_config(registry_url, auth_token) {
core.debug(`upm_config_toml_path: "${upm_config_toml_path}"`);
const overwrite = core.getInput('overwrite') === 'true';
try {
await fs.promises.access(upm_config_toml_path);
if (overwrite) {
await fs.promises.writeFile(upm_config_toml_path, '');
const fileHandle = await fs.promises.open(upm_config_toml_path, 'r');
try {
if (overwrite) {
await fs.promises.writeFile(upm_config_toml_path, '');
}
}
finally {
fileHandle.close();
}
}
catch (error) {
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "upm-config",
"version": "2.0.3",
"version": "2.0.4",
"description": "A GitHub Action for setting Unity Engine UPM private scoped registry credentials in CI/CD workflows.",
"author": "RageAgainstThePixel",
"license": "MIT",
Expand Down
10 changes: 7 additions & 3 deletions src/upm_config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,13 @@ async function save_upm_config(registry_url: string, auth_token: string): Promis
core.debug(`upm_config_toml_path: "${upm_config_toml_path}"`);
const overwrite = core.getInput('overwrite') === 'true';
try {
await fs.promises.access(upm_config_toml_path);
if (overwrite) {
await fs.promises.writeFile(upm_config_toml_path, '');
const fileHandle = await fs.promises.open(upm_config_toml_path, 'r');
try {
if (overwrite) {
await fs.promises.writeFile(upm_config_toml_path, '');
}
} finally {
fileHandle.close();
}
} catch (error) {
await fs.promises.writeFile(upm_config_toml_path, '');
Expand Down

0 comments on commit 7df97b9

Please sign in to comment.