Skip to content

Commit cda1865

Browse files
devlooped-botkzu
authored andcommitted
⬆️ Bump files with dotnet-file sync
# devlooped/oss - Update combine prs default message devlooped/oss@74189b0 - Ignore errors creating the PR devlooped/oss@b97b8f1 - Always pass in auth headers to GH API devlooped/oss@a922d03 - Since dependabot doesn't consume API requests, do it more frequently devlooped/oss@4f070a4 - Move format check for last devlooped/oss@7db501b - Make build matrix configurable per-repo devlooped/oss@391da5e - Rename matrix lookup job and steps devlooped/oss@cf8e339 - Switch to newer syntax for output variables devlooped/oss@9dc1ae2
1 parent f118f3f commit cda1865

7 files changed

Lines changed: 204 additions & 27 deletions

File tree

.github/dependabot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ updates:
66
- package-ecosystem: nuget
77
directory: /
88
schedule:
9-
interval: weekly
9+
interval: daily

.github/workflows/build.yml

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,30 +23,29 @@ defaults:
2323
shell: bash
2424

2525
jobs:
26-
dotnet-format:
26+
os-matrix:
2727
runs-on: ubuntu-latest
28+
outputs:
29+
matrix: ${{ steps.lookup.outputs.matrix }}
2830
steps:
2931
- name: 🤘 checkout
3032
uses: actions/checkout@v2
31-
with:
32-
submodules: recursive
33-
fetch-depth: 0
34-
35-
- name: ⚙ dotnet
36-
uses: actions/setup-dotnet@v1
37-
with:
38-
dotnet-version: '6.0.x'
39-
40-
- name: ✓ ensure format
41-
run: dotnet format --verify-no-changes -v:diag --exclude ~/.nuget
33+
34+
- name: 🔎 lookup
35+
id: lookup
36+
shell: pwsh
37+
run: |
38+
$path = './.github/workflows/os-matrix.json'
39+
$os = if (test-path $path) { cat $path } else { '["ubuntu-latest"]' }
40+
echo "matrix=$os" >> $env:GITHUB_OUTPUT
4241
4342
build:
43+
needs: os-matrix
4444
name: build-${{ matrix.os }}
45-
needs: dotnet-format
4645
runs-on: ${{ matrix.os }}
4746
strategy:
4847
matrix:
49-
os: [windows-latest, ubuntu-latest, macOS-latest]
48+
os: ${{ fromJSON(needs.os-matrix.outputs.matrix) }}
5049
steps:
5150
- name: 🤘 checkout
5251
uses: actions/checkout@v2
@@ -83,3 +82,21 @@ jobs:
8382
run: |
8483
dotnet tool install -g --version 4.0.18 sleet
8584
sleet push bin --config none -f --verbose -p "SLEET_FEED_CONTAINER=nuget" -p "SLEET_FEED_CONNECTIONSTRING=${{ secrets.SLEET_CONNECTION }}" -p "SLEET_FEED_TYPE=azure" || echo "No packages found"
85+
86+
dotnet-format:
87+
runs-on: ubuntu-latest
88+
needs: build
89+
steps:
90+
- name: 🤘 checkout
91+
uses: actions/checkout@v2
92+
with:
93+
submodules: recursive
94+
fetch-depth: 0
95+
96+
- name: ⚙ dotnet
97+
uses: actions/setup-dotnet@v1
98+
with:
99+
dotnet-version: '6.0.x'
100+
101+
- name: ✓ ensure format
102+
run: dotnet format --verify-no-changes -v:diag --exclude ~/.nuget

.github/workflows/combine-prs.yml

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
name: '⛙ combine-prs'
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
branchExpression:
7+
description: 'Regular expression to match against PR branches to find combinable PRs'
8+
required: true
9+
default: 'dependabot'
10+
mustBeGreen:
11+
description: 'Only combine PRs that are green (status is success)'
12+
required: true
13+
default: true
14+
combineTitle:
15+
description: 'Title of the combined PR'
16+
required: true
17+
default: '⬆️ Bump dependencies'
18+
combineBranchName:
19+
description: 'Name of the branch to combine PRs into'
20+
required: true
21+
default: 'combine-prs'
22+
ignoreLabel:
23+
description: 'Exclude PRs with this label'
24+
required: true
25+
default: 'nocombine'
26+
27+
jobs:
28+
combine-prs:
29+
name: ${{ github.event.inputs.combineBranchName }}
30+
runs-on: ubuntu-latest
31+
steps:
32+
- uses: actions/github-script@v6
33+
with:
34+
github-token: ${{secrets.GITHUB_TOKEN}}
35+
script: |
36+
const pulls = await github.paginate('GET /repos/:owner/:repo/pulls', {
37+
owner: context.repo.owner,
38+
repo: context.repo.repo
39+
});
40+
const branchRegExp = new RegExp(`${{github.event.inputs.branchExpression}}`);
41+
let branchesAndPRStrings = [];
42+
let baseBranch = null;
43+
let baseBranchSHA = null;
44+
for (const pull of pulls) {
45+
const branch = pull['head']['ref'];
46+
console.log('Pull for branch: ' + branch);
47+
if (branchRegExp.test(branch)) {
48+
console.log('Branch matched prefix: ' + branch);
49+
let statusOK = true;
50+
if(${{ github.event.inputs.mustBeGreen }}) {
51+
console.log('Checking green status: ' + branch);
52+
const stateQuery = `query($owner: String!, $repo: String!, $pull_number: Int!) {
53+
repository(owner: $owner, name: $repo) {
54+
pullRequest(number:$pull_number) {
55+
commits(last: 1) {
56+
nodes {
57+
commit {
58+
statusCheckRollup {
59+
state
60+
}
61+
}
62+
}
63+
}
64+
}
65+
}
66+
}`
67+
const vars = {
68+
owner: context.repo.owner,
69+
repo: context.repo.repo,
70+
pull_number: pull['number']
71+
};
72+
const result = await github.graphql(stateQuery, vars);
73+
const [{ commit }] = result.repository.pullRequest.commits.nodes;
74+
const state = commit.statusCheckRollup.state
75+
console.log('Validating status: ' + state);
76+
if(state != 'SUCCESS') {
77+
console.log('Discarding ' + branch + ' with status ' + state);
78+
statusOK = false;
79+
}
80+
}
81+
console.log('Checking labels: ' + branch);
82+
const labels = pull['labels'];
83+
for(const label of labels) {
84+
const labelName = label['name'];
85+
console.log('Checking label: ' + labelName);
86+
if(labelName == '${{ github.event.inputs.ignoreLabel }}') {
87+
console.log('Discarding ' + branch + ' with label ' + labelName);
88+
statusOK = false;
89+
}
90+
}
91+
if (statusOK) {
92+
console.log('Adding branch to array: ' + branch);
93+
const prString = '#' + pull['number'] + ' ' + pull['title'];
94+
branchesAndPRStrings.push({ branch, prString });
95+
baseBranch = pull['base']['ref'];
96+
baseBranchSHA = pull['base']['sha'];
97+
}
98+
}
99+
}
100+
if (branchesAndPRStrings.length == 0) {
101+
core.setFailed('No PRs/branches matched criteria');
102+
return;
103+
}
104+
if (branchesAndPRStrings.length == 1) {
105+
core.setFailed('Only one PR/branch matched criteria');
106+
return;
107+
}
108+
109+
try {
110+
await github.rest.git.createRef({
111+
owner: context.repo.owner,
112+
repo: context.repo.repo,
113+
ref: 'refs/heads/' + '${{ github.event.inputs.combineBranchName }}',
114+
sha: baseBranchSHA
115+
});
116+
} catch (error) {
117+
console.log(error);
118+
core.setFailed('Failed to create combined branch - maybe a branch by that name already exists?');
119+
return;
120+
}
121+
122+
let combinedPRs = [];
123+
let mergeFailedPRs = [];
124+
for(const { branch, prString } of branchesAndPRStrings) {
125+
try {
126+
await github.rest.repos.merge({
127+
owner: context.repo.owner,
128+
repo: context.repo.repo,
129+
base: '${{ github.event.inputs.combineBranchName }}',
130+
head: branch,
131+
});
132+
console.log('Merged branch ' + branch);
133+
combinedPRs.push(prString);
134+
} catch (error) {
135+
console.log('Failed to merge branch ' + branch);
136+
mergeFailedPRs.push(prString);
137+
}
138+
}
139+
140+
console.log('Creating combined PR');
141+
const combinedPRsString = combinedPRs.join('\n');
142+
let body = '⛙ Combined PRs:\n' + combinedPRsString;
143+
if(mergeFailedPRs.length > 0) {
144+
const mergeFailedPRsString = mergeFailedPRs.join('\n');
145+
body += '\n\n⚠️ The following PRs were left out due to merge conflicts:\n' + mergeFailedPRsString
146+
}
147+
await github.rest.pulls.create({
148+
owner: context.repo.owner,
149+
repo: context.repo.repo,
150+
title: '⛙ ${{github.event.inputs.combineTitle}}',
151+
head: '${{ github.event.inputs.combineBranchName }}',
152+
base: baseBranch,
153+
body: body
154+
});

.github/workflows/dotnet-file.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ jobs:
7070

7171
- name: ✍ pull request
7272
uses: peter-evans/create-pull-request@v3
73+
continue-on-error: true
7374
with:
7475
base: main
7576
branch: dotnet-file-sync

.github/workflows/release-notes.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ jobs:
4242
env:
4343
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4444
run: |
45-
$id = iwr "$env:GITHUB_API_URL/repos/$env:GITHUB_REPOSITORY/releases/tags/$env:CURRENT_TAG" |
45+
$headers = @{ 'Accept'='application/vnd.github.v3+json;charset=utf-8'; 'Authorization' = "bearer $env:GITHUB_TOKEN" }
46+
$id = iwr "$env:GITHUB_API_URL/repos/$env:GITHUB_REPOSITORY/releases/tags/$env:CURRENT_TAG" -Headers $headers |
4647
select -ExpandProperty Content |
4748
ConvertFrom-Json |
4849
select -ExpandProperty id
4950
5051
$notes = (Get-Content .\changelog.md | where { !($_ -like '\*') } | %{ $_.replace('\', '\\').replace('"', "'").replace('undefined', 'un-defined') }) -join '\n'
51-
$headers = @{ 'Accept'='application/vnd.github.v3+json;charset=utf-8'; 'Authorization' = "bearer $env:GITHUB_TOKEN" }
5252
$body = '{ "body":"' + $notes + '" }'
5353
5454
# ensure we can convert to json

.netconfig

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@
4444
weak
4545
[file ".github/dependabot.yml"]
4646
url = https://github.com/devlooped/oss/blob/main/.github/dependabot.yml
47-
sha = 0683ee777d7d878d4bf013d7deea352685135a05
48-
etag = 2fc8a0d2b47091b058ae3e1f68333492044b49a684621f4939a0bce5bff869d5
47+
sha = 4f070a477b4162a280f02722ae666376ae4fcc71
48+
etag = 35f2134fff3b0235ff8dac8618a76198c8ef533ad2f29628bbb435cd1134d638
4949
weak
5050
[file ".github/workflows/build.yml"]
5151
url = https://github.com/devlooped/oss/blob/main/.github/workflows/build.yml
52-
sha = e19ed3228a0ac7f64a43197241a788fb224a683f
53-
etag = 4e65025ab77d15766520234d3a9953ff4f1eea91620e1080f10909de19804877
52+
sha = 9dc1ae21afde1e6e8186e929068e8e4d80b3c212
53+
etag = 59e7663888953a1ffed92d95aae24b72528ca71f818bb5acc26c946ea5ee6421
5454
weak
5555
[file ".github/workflows/changelog.yml"]
5656
url = https://github.com/devlooped/oss/blob/main/.github/workflows/changelog.yml
@@ -59,8 +59,8 @@
5959
weak
6060
[file ".github/workflows/dotnet-file.yml"]
6161
url = https://github.com/devlooped/oss/blob/main/.github/workflows/dotnet-file.yml
62-
sha = aed791a3a35919e3088cd2bde604cbae6f47b393
63-
etag = 0f7649805f5e84fba5104339bfd0c21ac4747b65186b16eab39f863e2db7a3e1
62+
sha = b97b8f19569fa1b93cece4b22afab0e838693c5a
63+
etag = a9d246d40ee9cf9796fe694835b787cba415f4f23e919c6a763dd3ebfa607681
6464
weak
6565
[file ".github/workflows/publish.yml"]
6666
url = https://github.com/devlooped/oss/blob/main/.github/workflows/publish.yml
@@ -69,8 +69,8 @@
6969
weak
7070
[file ".github/workflows/release-notes.yml"]
7171
url = https://github.com/devlooped/oss/blob/main/.github/workflows/release-notes.yml
72-
sha = be8f625e4cf5c2c572c7e56ba6dc4c4935ab0c00
73-
etag = d1de9cb9c403ed8632d22d4cc153ae63b075266b9ce638b9ac73fd47dd2bccc1
72+
sha = a922d0300a188bbd872bcf8ca48c6b7a13dee5df
73+
etag = 5db902d761d80de182417cfbece00cbb6d1fa4b99a945b3a97c57f58f7043b5d
7474
weak
7575
[file ".gitignore"]
7676
url = https://github.com/devlooped/oss/blob/main/.gitignore
@@ -167,3 +167,8 @@
167167
sha = e347e5c7b91aaeb11eff95037c2c0b54206cc976
168168
etag = 06319ff741c03cf4cd5113926d490ec09999a85b5a0e0480ce44222db026341a
169169
weak
170+
[file ".github/workflows/combine-prs.yml"]
171+
url = https://github.com/devlooped/oss/blob/main/.github/workflows/combine-prs.yml
172+
sha = 74189b061850a3527676d76281de61044abc86a2
173+
etag = 10106929413a89658d22c36b5b934c598809e1deb8cdd994ec846f824195aac6
174+
weak

readme.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,9 @@ The versioning scheme for packages is:
127127
[![C. Augusto Proiete](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/augustoproiete.png "C. Augusto Proiete")](https://github.com/augustoproiete)
128128
[![Kirill Osenkov](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/KirillOsenkov.png "Kirill Osenkov")](https://github.com/KirillOsenkov)
129129
[![MFB Technologies, Inc.](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/MFB-Technologies-Inc.png "MFB Technologies, Inc.")](https://github.com/MFB-Technologies-Inc)
130-
[![Amazon Web Services](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/aws.png "Amazon Web Services")](https://github.com/aws)
131130
[![SandRock](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/sandrock.png "SandRock")](https://github.com/sandrock)
132-
[![David Pallmann](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/davidpallmann.png "David Pallmann")](https://github.com/davidpallmann)
131+
[![Andy Gocke](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/agocke.png "Andy Gocke")](https://github.com/agocke)
132+
[![Shahzad Huq](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/shahzadhuq.png "Shahzad Huq")](https://github.com/shahzadhuq)
133133

134134

135135
<!-- sponsors.md -->

0 commit comments

Comments
 (0)