Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try to fix workflows #416

Merged
merged 1 commit into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 0 additions & 61 deletions .github/workflows/TabsAndSpaces.yml

This file was deleted.

37 changes: 33 additions & 4 deletions .github/workflows/build-sqlfile.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Regenerate SQL Main File
name: Format and Regenerate SQL Main File
on:
push:
branches:
Expand All @@ -10,18 +10,47 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Checkout Code
run: |
git config --global user.name 'Darling Data'
git config --global user.email 'erik@erikdarling.com'
git checkout
- name: Trim trailing whitespace and replace Tabs
shell: pwsh
run: |
$changedFiles = git --no-pager diff --name-only --relative --diff-filter=AM "${{ github.event.before }}" "${{ github.sha }}" -- '***.sql'
$tabSize = 4
$changedFiles | ForEach-Object {
$outputString = ""
$fullPath = $_
$Content = Get-Content $fullPath
foreach ($Ctnt in $Content) {
$CharArray = $Ctnt.ToCharArray()
$lineOutput = ""
$slidingOffset = 0
for ($charIdx = 0; $charIdx -lt $CharArray.Length; $charIdx++) {
if ($CharArray[$charIdx] -eq "`t") {
$currentTab = $tabSize - (($charIdx + $slidingOffset) % $tabSize)
$slidingOffset += $currentTab - 1
$lineOutput += (" " * $currentTab)
}
else {
$lineOutput += $CharArray[$charIdx]
}
}
$outputString += $lineOutput.TrimEnd() + "`n" # Add line output with trailing spaces removed to the output string, and add newline
}
Set-Content -Path $fullPath -Value ($outputString.TrimEnd())
}
- name: Compile SQL File
shell: pwsh
run: |
cd Install-All
./Merge-All.ps1
- name: Commit Updated File
run: |
git add ./Install-All/DarlingData.sql
git commit -am "Automation: Building SQL File"
git push
git add .
git commit -am "Automation: Format and Build SQL File"
git push