Skip to content

Commit 21b024d

Browse files
committed
Don't run generator if most recent pusher in PR is the generator itself
1 parent 42be0cc commit 21b024d

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

.github/workflows/generate-types-pr.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,28 @@ jobs:
1818
fetch-depth: 0
1919
ref: ${{ github.head_ref }}
2020

21+
- name: Check last commit author
22+
id: last-commit
23+
run: |
24+
AUTHOR=$(git log -1 --pretty=format:'%an')
25+
echo "author=$AUTHOR" >> $GITHUB_OUTPUT
26+
2127
- name: Setup .NET 9
28+
if: steps.last-commit.outputs.author != 'github-actions[bot]'
2229
uses: actions/setup-dotnet@v4
2330
with:
2431
dotnet-version: '9.0.x'
2532

2633
- name: Restore dependencies
34+
if: steps.last-commit.outputs.author != 'github-actions[bot]'
2735
run: dotnet restore
2836

2937
- name: Run generator
30-
run: dotnet run --project Generator/System.Management.Generator.csproj
38+
if: steps.last-commit.outputs.author != 'github-actions[bot]'
39+
run: dotnet run --project Generator/Generator.csproj
3140

3241
- name: Check for changes
42+
if: steps.last-commit.outputs.author != 'github-actions[bot]'
3343
id: git-check
3444
run: |
3545
git config --global user.name "github-actions[bot]"
@@ -42,7 +52,7 @@ jobs:
4252
fi
4353
4454
- name: Commit and push changes to PR branch
45-
if: steps.git-check.outputs.no_changes == 'false'
55+
if: steps.last-commit.outputs.author != 'github-actions[bot]' && steps.git-check.outputs.no_changes == 'false'
4656
run: |
4757
git commit -m "chore(types): update generated types (PR auto-update)"
4858
git push

0 commit comments

Comments
 (0)