Skip to content

Commit 9365f65

Browse files
Adds necessary params to config + adds logging and test runner (#4)
* only format necessary files * fixes file creation actions * Adds test gh action + adds some logging to transforms
1 parent 8fa45bf commit 9365f65

5 files changed

Lines changed: 46 additions & 7 deletions

File tree

.github/workflows/test.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
matrix:
15+
node-version: [20.x]
16+
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v4
20+
21+
- name: Setup Node.js ${{ matrix.node-version }}
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: ${{ matrix.node-version }}
25+
26+
- name: Install dependencies
27+
run: npm ci
28+
29+
- name: Run tests
30+
run: npm run test

action.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,13 @@ inputs:
88
description: "The ID of the deployment to run"
99
type: string
1010
required: true
11+
deploymentKey:
12+
description: "The deployment secret key which authorizes the action to run the deployment"
13+
type: string
14+
required: true
1115
outputs:
1216
pullRequestNumbers:
13-
description: "The pull request number that was created or updated (comma separated)"
17+
description: "The pull request number(s) created or updated (comma separated)"
1418
branding:
1519
icon: "star"
1620
color: "black"

dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/actions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export function resolveAction(
2323
case "file-delete":
2424
return `rm ${args["file-path"]}`;
2525
case "file-create":
26-
return `echo "${args["file-content"]}" > ${args["file-path"]}`;
26+
return `cat > ${args["file-path"]} << 'EOF'\n${args["file-content"]}\nEOF`;
2727
case "file-move":
2828
return `mv ${args["source-path"]} ${args["destination-path"]}`;
2929
case "folder-create":

src/main.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,14 @@ export default async function main() {
137137

138138
// Handle transforms
139139
if (isTransformEntry(entry)) {
140-
const transformEntry = entry.transform.sources.find(
141-
({ name }) => name === "transform.ts" || name === "transform.js"
142-
);
140+
console.log(entry.transform.sources);
141+
142+
const transformEntry = entry.transform.sources.find(({ name }) => {
143+
console.log(name, name === "transform.ts" || name === "transform.js");
144+
return name === "transform.ts" || name === "transform.js";
145+
});
146+
147+
console.log(transformEntry);
143148

144149
if (!transformEntry) {
145150
core.warning(
@@ -192,7 +197,7 @@ export default async function main() {
192197

193198
await exec("bash", [
194199
"-c",
195-
`git status --porcelain | awk '{print substr($0, 4)}' | xargs -r npx prettier --write`,
200+
`git status --porcelain | awk '{print substr($0, 4)}' | grep -E '\\.(ts|tsx|js|jsx)$' | xargs -r npx prettier --write`,
196201
]);
197202

198203
await commitAll(`@hypermod ${deployment.title}`);

0 commit comments

Comments
 (0)