diff --git a/.githooks/pre-commit b/.githooks/pre-commit deleted file mode 100755 index 59b0221..0000000 --- a/.githooks/pre-commit +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -files=$(git diff --cached --name-status) - -for file in $files; do - if [ "${file##*.}" = "pkl" ]; then - pkl eval "$file" -o "${file%.pkl}.generated.yml" - git add "${file%.pkl}.generated.yml" - fi -done diff --git a/.github/workflows/check-actions.pkl b/.github/pkl-workflows/check-actions.pkl similarity index 77% rename from .github/workflows/check-actions.pkl rename to .github/pkl-workflows/check-actions.pkl index ac3616e..dabb4ad 100644 --- a/.github/workflows/check-actions.pkl +++ b/.github/pkl-workflows/check-actions.pkl @@ -19,11 +19,8 @@ jobs { ...Steps.checkoutAndInstallPkl new { name = "Convert pkl actions to yaml" - run = """ - for file in .github/workflows/*.pkl; do - pkl eval "$file" -o "${file/.pkl/generated.yml}" - done - """ + `working-directory` = ".github/pkl-workflows" + run = "./updateWorkflows.sh" } new { name = "Verify if pkl actions are converted" diff --git a/.github/workflows/check-dist.pkl b/.github/pkl-workflows/check-dist.pkl similarity index 100% rename from .github/workflows/check-dist.pkl rename to .github/pkl-workflows/check-dist.pkl diff --git a/.github/workflows/ci.pkl b/.github/pkl-workflows/ci.pkl similarity index 100% rename from .github/workflows/ci.pkl rename to .github/pkl-workflows/ci.pkl diff --git a/.github/workflows/linter.pkl b/.github/pkl-workflows/linter.pkl similarity index 100% rename from .github/workflows/linter.pkl rename to .github/pkl-workflows/linter.pkl diff --git a/.github/workflows/modules/Steps.pkl b/.github/pkl-workflows/modules/Steps.pkl similarity index 100% rename from .github/workflows/modules/Steps.pkl rename to .github/pkl-workflows/modules/Steps.pkl diff --git a/.github/pkl-workflows/updateWorkflows.sh b/.github/pkl-workflows/updateWorkflows.sh new file mode 100755 index 0000000..8c71f0c --- /dev/null +++ b/.github/pkl-workflows/updateWorkflows.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +for file in *.pkl; do + pkl eval "$file" -o "../workflows/$(basename "${file/.pkl/.generated.yml}")" +done diff --git a/.github/workflows/check-actions.generated.yml b/.github/workflows/check-actions.generated.yml index 9c7fc94..0b525e4 100644 --- a/.github/workflows/check-actions.generated.yml +++ b/.github/workflows/check-actions.generated.yml @@ -18,9 +18,7 @@ jobs: with: pkl-version: 0.26.3 - name: Convert pkl actions to yaml - run: |- - for file in .github/workflows/*.pkl; do - pkl eval "$file" -o "${file/.pkl/generated.yml}" - done + working-directory: .github/pkl-workflows + run: ./updateWorkflows.sh - name: Verify if pkl actions are converted run: git diff --exit-code