Skip to content

Commit

Permalink
ci: try remove unnecessary actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Gustav-Eikaas committed Aug 10, 2023
1 parent 93ac967 commit 29edef4
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 21 deletions.
20 changes: 1 addition & 19 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,14 @@ on: # rebuild any PRs and main branch changes
push:

jobs:
build: # make sure build/ci work properly
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install Dependencies
run: npx pnpm i

- name: Build Code
run: npx pnpm build

test: # make sure the action works on a clean machine without building
changed: # make sure the action works on a clean machine without building
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0 # Required to fetch range

- name: Install Dependencies
run: npx pnpm i

- name: Build Code
run: npx pnpm build

# Run the action on the yarn-workspaces example
- name: Test Action
id: changedAction
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ outputs:

runs:
using: 'node16'
main: 'github-action/dist/main.js'
main: 'github-action/script/main.js'
29 changes: 29 additions & 0 deletions github-action/script/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { execSync } from 'child_process';
import { join } from 'path';
import { getInput, debug, setFailed, setOutput, setCommandEcho } from '@actions/core';
const run = async () => {
try {
setCommandEcho(true);
const turboCommand = getInput('turbo-command', { required: true });
const workingDirectory = getInput('working-directory', { required: false }) ?? './';
const cwd = join(process.cwd(), workingDirectory);
debug(`Running command: ${turboCommand} in directory ${workingDirectory}`);
const json = execSync(`npx turbo run ${turboCommand} --dry-run=json`, {
cwd: cwd,
encoding: 'utf-8',
});
debug(`Output from Turborepo: ${json}`);
const parsedOutput = JSON.parse(json);
const changed = !!parsedOutput.packages.length;
setOutput('changed', changed);
}
catch (error) {
if (error instanceof Error || typeof error === 'string') {
setFailed(error);
}
else {
setFailed('Unknown error occured.');
}
}
};
void run();
2 changes: 1 addition & 1 deletion github-action/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"lib": ["ES2022", "dom"],
"skipLibCheck": true,
"skipDefaultLibCheck": true,
"outDir": "dist"
"outDir": "script"
},
"exclude": ["node_modules"]
}

0 comments on commit 29edef4

Please sign in to comment.