Skip to content

Commit 0fc6ae0

Browse files
Switch build automation to PR-based workflow
Replace direct push to main with peter-evans/create-pull-request so the automation respects branch protection rules. Allow the automation/format-and-build branch in the PR source check. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent beda698 commit 0fc6ae0

2 files changed

Lines changed: 16 additions & 16 deletions

File tree

.github/workflows/build-sqlfile.yml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
- main
66
permissions:
77
contents: write
8+
pull-requests: write
89
jobs:
910
build-sql-file:
1011
runs-on: ubuntu-latest
@@ -13,11 +14,6 @@ jobs:
1314
with:
1415
fetch-depth: 0
1516
token: ${{ secrets.PAT_TOKEN }}
16-
- name: Checkout Code
17-
run: |
18-
git config --global user.name 'Darling Data'
19-
git config --global user.email 'erik@erikdarling.com'
20-
git checkout
2117
- name: Trim trailing whitespace and replace Tabs
2218
shell: pwsh
2319
run: |
@@ -35,23 +31,27 @@ jobs:
3531
if ($CharArray[$charIdx] -eq "`t") {
3632
$currentTab = $tabSize - (($charIdx + $slidingOffset) % $tabSize)
3733
$slidingOffset += $currentTab - 1
38-
$lineOutput += (" " * $currentTab)
34+
$lineOutput += (" " * $currentTab)
3935
}
4036
else {
41-
$lineOutput += $CharArray[$charIdx]
37+
$lineOutput += $CharArray[$charIdx]
4238
}
4339
}
4440
$outputString += $lineOutput.TrimEnd() + "`n" # Add line output with trailing spaces removed to the output string, and add newline
4541
}
4642
Set-Content -Path $fullPath -Value ($outputString.TrimEnd())
47-
}
43+
}
4844
- name: Compile SQL File
4945
shell: pwsh
50-
run: |
46+
run: |
5147
cd Install-All
5248
./Merge-All.ps1
53-
- name: Commit Updated File
54-
run: |
55-
git add .
56-
git commit -am "Automation: Format and Build SQL File"
57-
git push
49+
- name: Create Pull Request
50+
uses: peter-evans/create-pull-request@v7
51+
with:
52+
token: ${{ secrets.PAT_TOKEN }}
53+
commit-message: "Automation: Format and Build SQL File"
54+
branch: automation/format-and-build
55+
title: "Automation: Format and Build SQL File"
56+
body: "Auto-generated formatting and rebuild of Install-All/DarlingData.sql"
57+
delete-branch: true

.github/workflows/main-dev.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
steps:
1313
- name: Check branches
1414
run: |
15-
if [ ${{ github.head_ref }} != "dev" ] && [ ${{ github.base_ref }} == "main" ]; then
16-
echo "Merge requests to main branch are only allowed from dev branch."
15+
if [ ${{ github.head_ref }} != "dev" ] && [ ${{ github.head_ref }} != "automation/format-and-build" ] && [ ${{ github.base_ref }} == "main" ]; then
16+
echo "Merge requests to main branch are only allowed from dev or automation branches."
1717
exit 1
1818
fi

0 commit comments

Comments
 (0)