Skip to content

Commit f6e827f

Browse files
Merge pull request #676 from erikdarlingdata/dev
Switch build automation to GitHub App token
2 parents 0e5acb6 + 39068c2 commit f6e827f

2 files changed

Lines changed: 20 additions & 14 deletions

File tree

.github/workflows/build-sqlfile.yml

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,28 @@
11
name: Format and Regenerate SQL Main File
2-
on:
2+
on:
33
push:
44
branches:
55
- main
66
permissions:
77
contents: write
8-
pull-requests: write
98
jobs:
109
build-sql-file:
1110
runs-on: ubuntu-latest
1211
steps:
12+
- name: Generate App Token
13+
id: app-token
14+
uses: actions/create-github-app-token@v2
15+
with:
16+
app-id: ${{ secrets.APP_ID }}
17+
private-key: ${{ secrets.APP_PRIVATE_KEY }}
1318
- uses: actions/checkout@v4
1419
with:
1520
fetch-depth: 0
16-
token: ${{ secrets.PAT_TOKEN }}
21+
token: ${{ steps.app-token.outputs.token }}
22+
- name: Configure Git
23+
run: |
24+
git config --global user.name 'Darling Data'
25+
git config --global user.email 'erik@erikdarling.com'
1726
- name: Trim trailing whitespace and replace Tabs
1827
shell: pwsh
1928
run: |
@@ -46,12 +55,9 @@ jobs:
4655
run: |
4756
cd Install-All
4857
./Merge-All.ps1
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
58+
- name: Commit and Push
59+
run: |
60+
git add .
61+
git diff --staged --quiet && echo "No changes to commit" && exit 0
62+
git commit -m "Automation: Format and Build SQL File"
63+
git push

.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.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."
15+
if [ ${{ github.head_ref }} != "dev" ] && [ ${{ github.base_ref }} == "main" ]; then
16+
echo "Merge requests to main branch are only allowed from dev branch."
1717
exit 1
1818
fi

0 commit comments

Comments
 (0)