Skip to content

Commit

Permalink
fix: ok
Browse files Browse the repository at this point in the history
  • Loading branch information
lodmfjord committed Feb 5, 2025
1 parent 8a9c486 commit ca6e1da
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 15 deletions.
13 changes: 2 additions & 11 deletions .github/actions/format-and-linter/action.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
name: 'Format and linter'
description: 'Action to format and linter'
inputs:
max-jobs:
description: 'Max jobs'
default: '2'
push-changes:
description: 'Should push changes'
default: 'false'
Expand All @@ -20,15 +17,9 @@ runs:
else
./infra/scripts/ci/git-check-dirty.sh "/" "nx format:write" "dirtybot"
fi
- name: Get Linter Jobs
- name: Lint
id: get-linter-jobs
shell: bash
run: |
node scripts/ci/_get_affected_projects.mjs
- name: Lint
if: ${{ env.AFFECTED_PROJECTS != '' }}
env:
MAX_JOBS: ${{ inputs.max-jobs }}
shell: bash
run: |
./scripts/ci/run-in-parallel-native.sh lint
7 changes: 3 additions & 4 deletions scripts/ci/_get_affected_projects.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// @ts-check
import { execSync } from 'child_process';
import { setOutput } from '@actions/core';

const IS_CI = process.env.CI === 'true';
const DEFAULT_TARGET = 'lint';
Expand Down Expand Up @@ -32,18 +31,18 @@ export const getAffectedProjectsString = (props = {}) => {
return projects.join(',');
}

export const setAffectedProjects = (props = {}) => {
export const runLinterAffectedProjects = (props = {}) => {
const chunks = getAffectedProjectsString(props);
if (!chunks) {
return;
}
console.log(`Affected projects for ${props.target ?? DEFAULT_TARGET}: ${chunks}`);
setOutput('AFFECTED_PROJECTS', `{"projects":${chunks}}`);
execSync(`npx nx run-many --target=${props.target ?? DEFAULT_TARGET} --projects=${chunks}`);
}

if (import.meta.url === `file://${process.argv[1]}`) {
if (IS_CI) {
setAffectedProjects();
runLinterAffectedProjects();
} else {
console.log(getAffectedProjectsArray());
}
Expand Down

0 comments on commit ca6e1da

Please sign in to comment.