File tree Expand file tree Collapse file tree 2 files changed +99
-0
lines changed
Expand file tree Collapse file tree 2 files changed +99
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Weekly Type Generation and Auto PR
2+
3+ on :
4+ schedule :
5+ - cron : ' 0 3 * * 1' # Every Monday at 03:00 UTC
6+ workflow_dispatch :
7+
8+ jobs :
9+ generate-and-pr :
10+ runs-on : ubuntu-latest
11+
12+ steps :
13+ - name : Checkout repository
14+ uses : actions/checkout@v4
15+ with :
16+ fetch-depth : 0
17+
18+ - name : Setup .NET 9
19+ uses : actions/setup-dotnet@v4
20+ with :
21+ dotnet-version : ' 9.0.x'
22+
23+ - name : Restore dependencies
24+ run : dotnet restore
25+
26+ - name : Run generator
27+ run : dotnet run --project Generator/System.Management.Generator.csproj
28+
29+ - name : Check for changes
30+ id : git-check
31+ run : |
32+ git config --global user.name "github-actions[bot]"
33+ git config --global user.email "github-actions[bot]@users.noreply.github.com"
34+ git add Types/**/*.g.cs
35+ if git diff --cached --quiet; then
36+ echo "no_changes=true" >> $GITHUB_OUTPUT
37+ else
38+ echo "no_changes=false" >> $GITHUB_OUTPUT
39+ fi
40+
41+ - name : Create Pull Request
42+ if : steps.git-check.outputs.no_changes == 'false'
43+ uses : peter-evans/create-pull-request@v6
44+ with :
45+ commit-message : " chore(types): update generated types"
46+ branch : " auto/generated-types-update"
47+ title : " chore(types): update generated types"
48+ body : |
49+ Automated update of generated types from learn.microsoft.com.
50+ This PR was created by a scheduled GitHub Action.
51+ delete-branch : true
Original file line number Diff line number Diff line change 1+ name : PR Type Generation
2+
3+ on :
4+ pull_request :
5+ paths :
6+ - ' Generator/*.*'
7+ - ' Types/**/*.g.cs'
8+ - ' .github/workflows/generate-types-pr.yml'
9+
10+ jobs :
11+ generate-and-commit :
12+ runs-on : ubuntu-latest
13+
14+ steps :
15+ - name : Checkout PR branch
16+ uses : actions/checkout@v4
17+ with :
18+ fetch-depth : 0
19+ ref : ${{ github.head_ref }}
20+
21+ - name : Setup .NET 9
22+ uses : actions/setup-dotnet@v4
23+ with :
24+ dotnet-version : ' 9.0.x'
25+
26+ - name : Restore dependencies
27+ run : dotnet restore
28+
29+ - name : Run generator
30+ run : dotnet run --project Generator/System.Management.Generator.csproj
31+
32+ - name : Check for changes
33+ id : git-check
34+ run : |
35+ git config --global user.name "github-actions[bot]"
36+ git config --global user.email "github-actions[bot]@users.noreply.github.com"
37+ git add Types/**/*.g.cs
38+ if git diff --cached --quiet; then
39+ echo "no_changes=true" >> $GITHUB_OUTPUT
40+ else
41+ echo "no_changes=false" >> $GITHUB_OUTPUT
42+ fi
43+
44+ - name : Commit and push changes to PR branch
45+ if : steps.git-check.outputs.no_changes == 'false'
46+ run : |
47+ git commit -m "chore(types): update generated types (PR auto-update)"
48+ git push
You can’t perform that action at this time.
0 commit comments