Skip to content

Commit 2ba10a7

Browse files
committed
Refactor action script, use bash instead
1 parent 76e3881 commit 2ba10a7

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

.github/workflows/they_said_to_compile.yaml

+13-9
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,29 @@ jobs:
1111
steps:
1212
- name: Checkout
1313
uses: actions/checkout@v2
14+
- name: Configure Git
15+
run: |
16+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
17+
git config --global user.name "github-actions[bot]"
1418
- name: Set up Python
1519
uses: actions/setup-python@v2
1620
with:
1721
python-version: '3.x'
1822
- name: Run Groovy Compiler
19-
shell: pwsh
2023
run: |
2124
# Find groovy files starts with _ on current directory
22-
$groovyFiles = Get-ChildItem -Path . -Filter "_*.groovy" -Recurse
25+
groovyFiles=$(find . -type f -name "_*.groovy")
26+
2327
# Compile each groovy file
24-
foreach ($file in $groovyFiles) {
25-
$compiledFile = "compiled/$($file.Name -replace '^_','')"
26-
Write-Host "Compiling $($file.FullName) to $compiledFile"
27-
python3 compiler.py $file.FullName $compiledFile
28-
}
28+
for file in $groovyFiles; do
29+
compiledFile="compiled/$(basename "$file" | sed 's/^_//')"
30+
echo "Compiling $file to $compiledFile"
31+
python3 compiler.py "$file" "$compiledFile"
32+
done
2933
- name: Commit and Push Changes
34+
env:
35+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3036
run: |
31-
git config --global user.email "github-actions[bot]@users.noreply.github.com"
32-
git config --global user.name "github-actions[bot]"
3337
git add compiled
3438
git commit -m "Compile Groovy Scripts"
3539
git push

0 commit comments

Comments
 (0)