Skip to content

Commit 657f8e9

Browse files
authored
KCLnet AWS credentials role change and dependabot auto-merge fix (#262)
KCLnet role update and pull request bug fix.
1 parent 4f272b0 commit 657f8e9

File tree

4 files changed

+49
-16
lines changed

4 files changed

+49
-16
lines changed

.github/dependabot.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,11 @@ updates:
44
directory: "/"
55
schedule:
66
interval: "weekly"
7+
8+
- package-ecosystem: "maven"
9+
directory: "/"
10+
open-pull-requests-limit: 4
11+
schedule:
12+
interval: "daily"
13+
ignore:
14+
- dependency-name: 'awssdk.*'

.github/workflows/dotnet.yml

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@ on:
1212
permissions:
1313
id-token: write
1414
contents: write
15+
pull-requests: write
16+
statuses: write
1517

1618
jobs:
1719
sample-run:
18-
timeout-minutes: 8
20+
timeout-minutes: 9
1921
runs-on: ${{ matrix.os }}
2022
defaults:
2123
run:
@@ -30,6 +32,8 @@ jobs:
3032
steps:
3133
- name: Checkout working directory
3234
uses: actions/checkout@v4
35+
with:
36+
ref: ${{ github.event.pull_request.head.sha }}
3337

3438
- name: Configure AWS Credentials
3539
uses: aws-actions/configure-aws-credentials@v4
@@ -51,8 +55,7 @@ jobs:
5155

5256
- name: Restore, Build, and Test
5357
run: |
54-
dotnet restore
55-
dotnet build --no-restore
58+
dotnet build
5659
dotnet test --no-build
5760
5861
- name: Install AWS SDK into projects
@@ -83,17 +86,25 @@ jobs:
8386
auto-merge-dependabot:
8487
needs: [sample-run]
8588
runs-on: ubuntu-latest
86-
if: github.event.pull_request.user.login == 'dependabot[bot]'
89+
if: github.actor == 'dependabot[bot]' && github.event.pull_request.user.login == 'dependabot[bot]'
8790
steps:
8891
- name: Fetch Dependabot metadata
8992
id: metadata
9093
uses: dependabot/fetch-metadata@v2
9194
with:
9295
alert-lookup: true
9396
github-token: "${{ secrets.GITHUB_TOKEN }}"
94-
- name: Enable auto-merge for Dependabot PRs
97+
98+
- name: Approve PR
9599
if: steps.metadata.outputs.update-type != 'version-update:semver-major'
96-
run: gh pr merge --auto --merge "$PR_URL"
100+
run: gh pr review --approve "$PR_URL"
97101
env:
98102
PR_URL: ${{github.event.pull_request.html_url}}
99103
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
104+
105+
# - name: Enable auto-merge for Dependabot PRs
106+
# if: steps.metadata.outputs.update-type != 'version-update:semver-major'
107+
# run: gh pr merge --auto --merge "$PR_URL"
108+
# env:
109+
# PR_URL: ${{github.event.pull_request.html_url}}
110+
# GH_TOKEN: ${{secrets.GITHUB_TOKEN}}

Bootstrap/Bootstrap.cs

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
using System.Diagnostics;
1111
using System.Linq;
1212
using System.Xml.Linq;
13+
using System.Net.Http;
14+
using System.Threading.Tasks;
1315
using CommandLine;
1416

1517
namespace Amazon.Kinesis.ClientLibrary.Bootstrap
@@ -61,12 +63,23 @@ public void Fetch(String folder)
6163
}
6264

6365
String destination = Path.Combine(folder, FileName);
64-
if (!File.Exists(destination))
65-
{
66-
var client = new WebClient();
67-
client.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");
68-
Console.Error.WriteLine(Url + " --> " + destination);
69-
client.DownloadFile(new Uri(Url), destination);
66+
if (!File.Exists(destination)) {
67+
using var client = new HttpClient();
68+
client.DefaultRequestHeaders.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");
69+
70+
try {
71+
Console.Error.WriteLine(Url + " --> " + destination);
72+
using var response = client.GetAsync(new Uri(Url)).GetAwaiter().GetResult();
73+
response.EnsureSuccessStatusCode();
74+
75+
using var fs = new FileStream(destination, FileMode.Create);
76+
response.Content.CopyToAsync(fs).GetAwaiter().GetResult();
77+
return;
78+
}
79+
catch (HttpRequestException ex)
80+
{
81+
throw new Exception($"Failed to download {FileName}: {ex.Message}", ex);
82+
}
7083
}
7184
}
7285

@@ -83,7 +96,7 @@ private String Url
8396
urlParts.Add(ArtifactId);
8497
urlParts.Add(Version);
8598
urlParts.Add(FileName);
86-
return "https://search.maven.org/remotecontent?filepath=" + String.Join("/", urlParts);
99+
return "https://repo1.maven.org/maven2/" + String.Join("/", urlParts);
87100
}
88101
}
89102
}
@@ -219,6 +232,8 @@ private static string FindJava(string java)
219232
}
220233
catch (Exception ex)
221234
{
235+
Console.WriteLine($"Error finding Java: {ex.Message}");
236+
return null;
222237
}
223238
//TODO find away to read from registery on different OSs
224239
// Failing that, look in the registry.
@@ -238,8 +253,7 @@ private static string FindJava(string java)
238253
// }
239254
// }
240255
//}
241-
242-
return null;
256+
//return null;
243257
}
244258

245259
public static void Main(string[] args)

ClientLibrary/ClientLibrary.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp5.0</TargetFramework>
4+
<TargetFramework>netcoreapp6.0</TargetFramework>
55
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
66
</PropertyGroup>
77

0 commit comments

Comments
 (0)