Skip to content

Commit a7dd32d

Browse files
authored
Fix pr commits (#464)
* Fix pr commits * Update go-format.yml * Update build-test.yml * Update go-format.yml * Update python-format.yml
1 parent cf76616 commit a7dd32d

File tree

3 files changed

+18
-53
lines changed

3 files changed

+18
-53
lines changed

.github/workflows/build-test.yml

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -184,13 +184,6 @@ jobs:
184184
matrix:
185185
python-version: [3.9]
186186
steps:
187-
- uses: actions/create-github-app-token@v2
188-
id: app-token
189-
with:
190-
# required
191-
app-id: ${{ secrets.GH_ORG_APP_ID }}
192-
private-key: ${{ secrets.GH_ORG_APP_PRIVATE_KEY }}
193-
owner: ${{ github.repository_owner }}
194187
- uses: actions/checkout@v4
195188
with:
196189
ref: ${{ github.event.pull_request.head.ref }}
@@ -252,15 +245,9 @@ jobs:
252245
git add "samples/**/*output.*"
253246
- name: git status
254247
run: git status
255-
- name: Check for modified files
256-
id: git-check
257-
run: echo ::set-output name=modified::$(if git diff-index --ignore-submodules --quiet HEAD --; then echo "false"; else echo "true"; fi)
258-
- name: Commit changes, if any
259-
if: steps.git-check.outputs.modified == 'true' && github.actor != 'dependabot[bot]'
260-
run: |
261-
git config --local user.email "github-actions[bot]@users.noreply.github.com"
262-
git config --local user.name "github-actions[bot]"
263-
git remote set-url origin https://${{ github.actor }}:${{ steps.app-token.outputs.token }}@github.com/${{ github.repository }}.git
264-
git fetch origin
265-
git commit -am "Updating script outputs"
266-
git push origin ${{github.event.pull_request.head.ref }}
248+
- name: Commit generated files
249+
uses: KittyCAD/gha-actions-public/pr-commit@main
250+
with:
251+
app-id: ${{ secrets.GH_ORG_APP_ID }}
252+
private-key: ${{ secrets.GH_ORG_APP_PRIVATE_KEY }}
253+
commit-message: "Updating script outputs"

.github/workflows/go-format.yml

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ on:
1212
paths:
1313
- '**.go'
1414
workflow_dispatch:
15-
inputs:
1615
jobs:
1716
format:
1817
# Check if the PR is not from a fork
@@ -37,16 +36,9 @@ jobs:
3736
ref: ${{ github.event.pull_request.head.ref }}
3837
- name: running golines
3938
run: golines --max-len=80 --reformat-tags --write-output .
40-
- name: Check for modified files
41-
id: git-check
42-
run: echo ::set-output name=modified::$(if git diff-index --ignore-submodules --quiet HEAD --; then echo "false"; else echo "true"; fi)
43-
44-
- name: Commit changes, if any
45-
if: steps.git-check.outputs.modified == 'true'
46-
run: |
47-
git config --local user.email "github-actions[bot]@users.noreply.github.com"
48-
git config --local user.name "github-actions[bot]"
49-
git remote set-url origin https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git
50-
git fetch origin
51-
git commit -am "LOOK ON MY REFORMAT, YE MIGHTY, AND DESPAIR!"
52-
git push origin ${{github.event.pull_request.head.ref }}
39+
- name: Commit generated files
40+
uses: KittyCAD/gha-actions-public/pr-commit@main
41+
with:
42+
app-id: ${{ secrets.GH_ORG_APP_ID }}
43+
private-key: ${{ secrets.GH_ORG_APP_PRIVATE_KEY }}
44+
commit-message: "LOOK ON MY REFORMAT, YE MIGHTY, AND DESPAIR!"

.github/workflows/python-format.yml

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,12 @@ on:
1212
paths:
1313
- '**.py'
1414
workflow_dispatch:
15-
inputs:
1615
jobs:
1716
format:
1817
# Check if the PR is not from a fork
1918
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
2019
runs-on: ubuntu-latest
2120
steps:
22-
- uses: actions/create-github-app-token@v2
23-
id: app-token
24-
with:
25-
# required
26-
app-id: ${{ secrets.GH_ORG_APP_ID }}
27-
private-key: ${{ secrets.GH_ORG_APP_PRIVATE_KEY }}
28-
owner: ${{ github.repository_owner }}
2921
- uses: actions/checkout@v4
3022
with:
3123
ref: ${{ github.event.pull_request.head.ref }}
@@ -36,15 +28,9 @@ jobs:
3628
uv sync
3729
uv run ruff format
3830
uv run ruff check --fix . */*/*.py
39-
- name: Check for modified files
40-
id: git-check
41-
run: echo ::set-output name=modified::$(if git diff-index --ignore-submodules --quiet HEAD --; then echo "false"; else echo "true"; fi)
42-
- name: Commit changes, if any
43-
if: steps.git-check.outputs.modified == 'true'
44-
run: |
45-
git config --local user.email "github-actions[bot]@users.noreply.github.com"
46-
git config --local user.name "github-actions[bot]"
47-
git remote set-url origin https://${{ github.actor }}:${{ steps.app-token.outputs.token }}@github.com/${{ github.repository }}.git
48-
git fetch origin
49-
git commit -am "LOOK ON MY REFORMAT, YE MIGHTY, AND DESPAIR!" || true
50-
git push origin ${{github.event.pull_request.head.ref }} || true
31+
- name: Commit generated files
32+
uses: KittyCAD/gha-actions-public/pr-commit@main
33+
with:
34+
app-id: ${{ secrets.GH_ORG_APP_ID }}
35+
private-key: ${{ secrets.GH_ORG_APP_PRIVATE_KEY }}
36+
commit-message: "LOOK ON MY REFORMAT, YE MIGHTY, AND DESPAIR!"

0 commit comments

Comments
 (0)