Skip to content

Commit

Permalink
Extra tabs fixes (#1361)
Browse files Browse the repository at this point in the history
* ensure github actions don't break formatting
* convert github action helper scripts to use tab indents
  • Loading branch information
petebacondarwin committed Jun 28, 2022
1 parent 40036e2 commit 2d93604
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 29 deletions.
26 changes: 13 additions & 13 deletions .github/extract-pr-and-workflow-id.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
const allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: context.payload.workflow_run.id,
owner: context.repo.owner,
repo: context.repo.repo,
run_id: context.payload.workflow_run.id,
});

for (const artifact of allArtifacts.data.artifacts) {
// Extract the PR number from the artifact name
const match = /^npm-package-wrangler-(\d+)$/.exec(artifact.name);
if (match) {
fs.appendFileSync(
process.env.GITHUB_ENV,
`\nWORKFLOW_RUN_PR=${match[1]}` +
`\nWORKFLOW_RUN_ID=${context.payload.workflow_run.id}`
);
break;
}
// Extract the PR number from the artifact name
const match = /^npm-package-wrangler-(\d+)$/.exec(artifact.name);
if (match) {
fs.appendFileSync(
process.env.GITHUB_ENV,
`\nWORKFLOW_RUN_PR=${match[1]}` +
`\nWORKFLOW_RUN_ID=${context.payload.workflow_run.id}`
);
break;
}
}
32 changes: 16 additions & 16 deletions .github/version-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@ const fs = require("fs");
const { exec } = require("child_process");

try {
const package = JSON.parse(
fs.readFileSync("./packages/wrangler/package.json")
);
exec("git rev-parse --short HEAD", (err, stdout) => {
if (err) {
console.log(err);
process.exit(1);
}
package.version = "0.0.0-" + stdout.trim();
fs.writeFileSync(
"./packages/wrangler/package.json",
JSON.stringify(package, null, 2) + "\n"
);
});
const package = JSON.parse(
fs.readFileSync("./packages/wrangler/package.json")
);
exec("git rev-parse --short HEAD", (err, stdout) => {
if (err) {
console.log(err);
process.exit(1);
}
package.version = "0.0.0-" + stdout.trim();
fs.writeFileSync(
"./packages/wrangler/package.json",
JSON.stringify(package, null, "\t") + "\n"
);
});
} catch (error) {
console.error(error);
process.exit(1);
console.error(error);
process.exit(1);
}

0 comments on commit 2d93604

Please sign in to comment.