Skip to content

Commit d4c67ee

Browse files
committed
Build before creating PR
Since we fixup proto files on build
1 parent 3d5c693 commit d4c67ee

File tree

1 file changed

+91
-9
lines changed

1 file changed

+91
-9
lines changed

.github/workflows/dotnet-file.yml

Lines changed: 91 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Synchronizes .netconfig-configured files with dotnet-file
1+
# Synchronizes .netconfig-configured files with dotnet-file
22
name: dotnet-file
33
on:
44
workflow_dispatch:
@@ -10,12 +10,94 @@ on:
1010
env:
1111
DOTNET_NOLOGO: true
1212

13-
jobs:
13+
defaults:
1414
run:
15-
permissions:
16-
contents: write
17-
uses: devlooped/oss/.github/workflows/dotnet-file-core.yml@main
18-
secrets:
19-
BOT_NAME: ${{ secrets.BOT_NAME }}
20-
BOT_EMAIL: ${{ secrets.BOT_EMAIL }}
21-
GH_TOKEN: ${{ secrets.GH_TOKEN }}
15+
shell: pwsh
16+
17+
jobs:
18+
sync:
19+
runs-on: ubuntu-latest
20+
continue-on-error: true
21+
steps:
22+
- name: 🤖 defaults
23+
uses: devlooped/actions-bot@v1
24+
with:
25+
name: ${{ secrets.BOT_NAME }}
26+
email: ${{ secrets.BOT_EMAIL }}
27+
gh_token: ${{ secrets.GH_TOKEN }}
28+
github_token: ${{ secrets.GITHUB_TOKEN }}
29+
30+
- name: 🤘 checkout
31+
uses: actions/checkout@v4
32+
with:
33+
fetch-depth: 0
34+
ref: main
35+
token: ${{ env.GH_TOKEN }}
36+
37+
- name: ⌛ rate
38+
if: github.event_name != 'workflow_dispatch'
39+
run: |
40+
# add random sleep since we run on fixed schedule
41+
sleep (get-random -max 60)
42+
# get currently authenticated user rate limit info
43+
$rate = gh api rate_limit | convertfrom-json | select -expandproperty rate
44+
# if we don't have at least 100 requests left, wait until reset
45+
if ($rate.remaining -lt 10) {
46+
$wait = ($rate.reset - (Get-Date (Get-Date).ToUniversalTime() -UFormat %s))
47+
echo "Rate limit remaining is $($rate.remaining), waiting for $($wait / 1000) seconds to reset"
48+
sleep $wait
49+
$rate = gh api rate_limit | convertfrom-json | select -expandproperty rate
50+
echo "Rate limit has reset to $($rate.remaining) requests"
51+
}
52+
53+
- name: 🔄 sync
54+
run: |
55+
dotnet tool update -g dotnet-gcm
56+
# store credentials in plaintext for linux compat
57+
git config --local credential.credentialStore plaintext
58+
dotnet gcm store --protocol=https --host=github.com --username=$env:GITHUB_ACTOR --password=$env:GH_TOKEN
59+
gh auth status
60+
61+
dotnet tool update -g dotnet-file
62+
$changelog = "$([System.IO.Path]::GetTempPath())dotnet-file.md"
63+
dotnet file sync -c:$changelog
64+
if (test-path $changelog) {
65+
echo 'CHANGES<<EOF' >> $env:GITHUB_ENV
66+
cat $changelog >> $env:GITHUB_ENV
67+
echo 'EOF' >> $env:GITHUB_ENV
68+
cat $changelog
69+
} else {
70+
echo 'No changelog was generated'
71+
}
72+
73+
- name: +Mᐁ includes
74+
uses: devlooped/actions-includes@v1
75+
with:
76+
validate: false
77+
78+
- name: ⚙ dotnet
79+
uses: devlooped/actions-dotnet-env@v1
80+
81+
- name: 🙏 build
82+
run: dotnet build -m:1 -bl:build.binlog
83+
84+
- name: 🧪 test
85+
run: |
86+
dotnet tool update -g dotnet-retest
87+
dotnet retest -- --no-build
88+
89+
- name: ✍ pull request
90+
uses: peter-evans/create-pull-request@v7
91+
with:
92+
base: main
93+
branch: dotnet-file-sync
94+
delete-branch: true
95+
labels: dependencies
96+
author: ${{ env.BOT_AUTHOR }}
97+
committer: ${{ env.BOT_AUTHOR }}
98+
commit-message: ⬆️ Bump files with dotnet-file sync
99+
100+
${{ env.CHANGES }}
101+
title: "⬆️ Bump files with dotnet-file sync"
102+
body: ${{ env.CHANGES }}
103+
token: ${{ env.GH_TOKEN }}

0 commit comments

Comments
 (0)