Skip to content

Commit

Permalink
im losing it
Browse files Browse the repository at this point in the history
  • Loading branch information
GitHub Actions committed Jul 23, 2023
1 parent 8a93d2c commit 72a027b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
7 changes: 6 additions & 1 deletion build/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
const core = __importStar(__nccwpck_require__(2186));
const fs = __importStar(__nccwpck_require__(7147));
const exec_1 = __nccwpck_require__(1514);
const execute = async (command, options = {}) => {
let stdOut = "";
Expand Down Expand Up @@ -66,10 +67,14 @@ const run = async () => {
else {
core.debug(`Files to format: ${files.join(', ')}`);
for (const file of files) {
const { err, stdOut } = await execute(`rstfmt "${file}" > "${file}"`, { silent: false });
const { err, stdOut } = await execute(`rstfmt "${file}"`, { silent: false });
if (err) {
core.setFailed(stdOut);
}
else {
// Write the formatted content back to the file.
fs.writeFileSync(file, stdOut);
}
}
}
});
Expand Down
5 changes: 4 additions & 1 deletion index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,12 @@ const run = async () => {
} else {
core.debug(`Files to format: ${files.join(', ')}`);
for (const file of files) {
const { err, stdOut } = await execute(`rstfmt "${file}" > "${file}"`, { silent: false });
const { err, stdOut } = await execute(`rstfmt "${file}"`, { silent: false });
if (err) {
core.setFailed(stdOut);
} else {
// Write the formatted content back to the file.
fs.writeFileSync(file, stdOut);
}
}
}
Expand Down

0 comments on commit 72a027b

Please sign in to comment.