Skip to content

Commit

Permalink
Getting closer. I think.
Browse files Browse the repository at this point in the history
  • Loading branch information
tippmar-nr committed Jul 11, 2024
1 parent f2fa5f5 commit 385990c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/nuget_slack_notifications.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ name: Check for new core technologies

on:
schedule:
- cron: '0 10 * * *'
- cron: '0 10 * * 1' # Every Monday at 10:00 AM
workflow_dispatch:
inputs:
daysToSearch:
description: "Days of NuGet history to search for package updates"
default: "1"
description: "Days of NuGet history to search for package updates (0 to search since last run of this workflow on main)"
default: "0"
type: string
testMode:
description: "If checked, no notification message will be sent to the team channel, nor will any Github issues be created."
Expand Down Expand Up @@ -50,6 +50,7 @@ jobs:
dotnet publish -o ${{ env.scan-tool-publish-path }}
- name: Find timestamp of most recent run of this workflow and set as an environment variable
if: inputs.daysToSearch == '0' || github.event_name == 'schedule'
env:
GH_TOKEN: ${{ github.token }}
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/scripts/nugetSlackNotifications/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class Program
private static readonly HttpClient _client = new();
private static List<NugetVersionData> _newVersions = new();

private static readonly int _daysToSearch = int.TryParse(Environment.GetEnvironmentVariable("DOTTY_DAYS_TO_SEARCH"), out var days) ? days : 1; // How many days of package release history to scan for changes
private static readonly int _daysToSearch = int.TryParse(Environment.GetEnvironmentVariable("DOTTY_DAYS_TO_SEARCH"), out var days) ? int.Max(1, days) : 1; // How many days of package release history to scan for changes
private static readonly bool _testMode = bool.TryParse(Environment.GetEnvironmentVariable("DOTTY_TEST_MODE"), out var testMode) ? testMode : false;
private static readonly string _webhook = Environment.GetEnvironmentVariable("DOTTY_WEBHOOK");
private static readonly string _githubToken = Environment.GetEnvironmentVariable("DOTTY_TOKEN");
Expand All @@ -40,7 +40,7 @@ static async Task Main()
// Otherwise, search from _lastRunTimestamp.
var searchTime = _lastRunTimestamp == DateTimeOffset.MinValue ? DateTimeOffset.UtcNow.Date.AddDays(-_daysToSearch) : _lastRunTimestamp;

Log.Information($"Searching for package updates between {searchTime.ToUniversalTime():s}Z and {DateTimeOffset.UtcNow.ToUniversalTime():s}Z.");
Log.Information($"Searching for package updates since {searchTime.ToUniversalTime():s}Z.");

// initialize nuget repo
var ps = new PackageSource("https://api.nuget.org/v3/index.json");
Expand Down

0 comments on commit 385990c

Please sign in to comment.