Skip to content

Commit

Permalink
Teste å heller kalle prettier fra action
Browse files Browse the repository at this point in the history
  • Loading branch information
torhakon committed Aug 29, 2024
1 parent 3292a86 commit d101d1d
Showing 1 changed file with 35 additions and 5 deletions.
40 changes: 35 additions & 5 deletions .github/workflows/ciStaticCodeValidation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,46 @@ jobs:
run: |
npm ci
- name: "Verify prettier"
- name: "Set variables"
id: paths
run: |
if [ ${{ inputs.validateEntireRepo }} ]; then
npx prettier . --check
prettierPathsToValidate ='.'
eslintPathsToValidate='.'
sfCodeAnalyzerPathToValidate='src'
else
#Find diff
mapfile -t diffed_files_to_lint < <(git diff --name-only --diff-filter=d HEAD~ -- \*.{cls,cmp,component,css,html,js,json,md,page,trigger,xml,yaml,yml})
npx prettier "${diffed_files_to_lint[@]}" --check
mapfile -t prettier_diffed_files_to_lint < <(git diff --name-only --diff-filter=d HEAD~ -- \*.{cls,cmp,component,css,html,js,json,md,page,trigger,xml,yaml,yml})
mapfile -t eslint_diffed_files_to_lint < <(git diff --name-only --diff-filter=d HEAD~ -- \*.js})
mapfile -t codeAnalyzer_diffed_sf_files < <(git diff --name-only --diff-filter=d HEAD~ -- src\**\*.{cls,cmp,component,css,html,js,json,page,trigger,xml})
codeAnalyzer_json=$(jq -c -n '$ARGS.positional' --args "${codeAnalyzer_diffed_sf_files[@]}")
prettierPathsToValidate ="${prettier_diffed_files_to_lint[@]}"
eslintPathsToValidate="${eslint_diffed_files_to_lint[@]}"
sfCodeAnalyzerPathToValidate=fromJson($codeAnalyzer_json)
fi
echo "prettierPathsToValidate=$prettierPathsToValidate" >> $GITHUB_OUTPUT
echo "eslintPathsToValidate=$eslintPathsToValidate" >> $GITHUB_OUTPUT
echo "sfCodeAnalyzerPathToValidate=$sfCodeAnalyzerPathToValidate" >> $GITHUB_OUTPUT
- uses: navikt/sf-platform/.github/actions/prettierCheck@main
with:
pathToValidate: ${{ steps.paths.outputs.prettierPathsToValidate }}

# - name: "Verify prettier"
# run: |
# if [ ${{ inputs.validateEntireRepo }} ]; then
# npx prettier . --check
# else
# #Find diff
# mapfile -t diffed_files_to_lint < <(git diff --name-only --diff-filter=d HEAD~ -- \*.{cls,cmp,component,css,html,js,json,md,page,trigger,xml,yaml,yml})
# npx prettier "${diffed_files_to_lint[@]}" --check
# fi
# - name: "Verify prettier"
# uses: navikt/sf-platform/.github/actions/prettierCheck
# with:
# pathToValidate: .

- name: "Run eslint"
run: |
if [ ${{ inputs.validateEntireRepo }} ]; then
Expand Down

0 comments on commit d101d1d

Please sign in to comment.