diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 841f056..58025f0 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -4,3 +4,11 @@ updates: directory: "/" schedule: interval: "weekly" + + - package-ecosystem: "maven" + directory: "/" + open-pull-requests-limit: 4 + schedule: + interval: "daily" + ignore: + - dependency-name: 'awssdk.*' \ No newline at end of file diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 9311582..ebf151c 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -12,10 +12,12 @@ on: permissions: id-token: write contents: write + pull-requests: write + statuses: write jobs: sample-run: - timeout-minutes: 8 + timeout-minutes: 9 runs-on: ${{ matrix.os }} defaults: run: @@ -30,6 +32,8 @@ jobs: steps: - name: Checkout working directory uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} - name: Configure AWS Credentials uses: aws-actions/configure-aws-credentials@v4 @@ -51,8 +55,7 @@ jobs: - name: Restore, Build, and Test run: | - dotnet restore - dotnet build --no-restore + dotnet build dotnet test --no-build - name: Install AWS SDK into projects @@ -83,7 +86,7 @@ jobs: auto-merge-dependabot: needs: [sample-run] runs-on: ubuntu-latest - if: github.event.pull_request.user.login == 'dependabot[bot]' + if: github.actor == 'dependabot[bot]' && github.event.pull_request.user.login == 'dependabot[bot]' steps: - name: Fetch Dependabot metadata id: metadata @@ -91,9 +94,17 @@ jobs: with: alert-lookup: true github-token: "${{ secrets.GITHUB_TOKEN }}" - - name: Enable auto-merge for Dependabot PRs + + - name: Approve PR if: steps.metadata.outputs.update-type != 'version-update:semver-major' - run: gh pr merge --auto --merge "$PR_URL" + run: gh pr review --approve "$PR_URL" env: PR_URL: ${{github.event.pull_request.html_url}} GH_TOKEN: ${{secrets.GITHUB_TOKEN}} + +# - name: Enable auto-merge for Dependabot PRs +# if: steps.metadata.outputs.update-type != 'version-update:semver-major' +# run: gh pr merge --auto --merge "$PR_URL" +# env: +# PR_URL: ${{github.event.pull_request.html_url}} +# GH_TOKEN: ${{secrets.GITHUB_TOKEN}} diff --git a/Bootstrap/Bootstrap.cs b/Bootstrap/Bootstrap.cs index 847dc2a..6b1afb0 100644 --- a/Bootstrap/Bootstrap.cs +++ b/Bootstrap/Bootstrap.cs @@ -10,6 +10,8 @@ using System.Diagnostics; using System.Linq; using System.Xml.Linq; +using System.Net.Http; +using System.Threading.Tasks; using CommandLine; namespace Amazon.Kinesis.ClientLibrary.Bootstrap @@ -61,12 +63,23 @@ public void Fetch(String folder) } String destination = Path.Combine(folder, FileName); - if (!File.Exists(destination)) - { - var client = new WebClient(); - client.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)"); - Console.Error.WriteLine(Url + " --> " + destination); - client.DownloadFile(new Uri(Url), destination); + if (!File.Exists(destination)) { + using var client = new HttpClient(); + client.DefaultRequestHeaders.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)"); + + try { + Console.Error.WriteLine(Url + " --> " + destination); + using var response = client.GetAsync(new Uri(Url)).GetAwaiter().GetResult(); + response.EnsureSuccessStatusCode(); + + using var fs = new FileStream(destination, FileMode.Create); + response.Content.CopyToAsync(fs).GetAwaiter().GetResult(); + return; + } + catch (HttpRequestException ex) + { + throw new Exception($"Failed to download {FileName}: {ex.Message}", ex); + } } } @@ -83,7 +96,7 @@ private String Url urlParts.Add(ArtifactId); urlParts.Add(Version); urlParts.Add(FileName); - return "https://search.maven.org/remotecontent?filepath=" + String.Join("/", urlParts); + return "https://repo1.maven.org/maven2/" + String.Join("/", urlParts); } } } @@ -219,6 +232,8 @@ private static string FindJava(string java) } catch (Exception ex) { + Console.WriteLine($"Error finding Java: {ex.Message}"); + return null; } //TODO find away to read from registery on different OSs // Failing that, look in the registry. @@ -238,8 +253,7 @@ private static string FindJava(string java) // } // } //} - - return null; + //return null; } public static void Main(string[] args) diff --git a/ClientLibrary/ClientLibrary.csproj b/ClientLibrary/ClientLibrary.csproj index 7ba2356..3e95418 100644 --- a/ClientLibrary/ClientLibrary.csproj +++ b/ClientLibrary/ClientLibrary.csproj @@ -1,7 +1,7 @@  - netcoreapp5.0 + netcoreapp6.0 false