From e9fd2f5034df309f3590309a607ff35c74a95dfa Mon Sep 17 00:00:00 2001 From: Eris Jakupi Date: Mon, 1 Sep 2025 10:08:07 +0200 Subject: [PATCH 01/17] add a new line to weather forecast --- src/GitHubActionsDotNet.Api/Models/WeatherForecast.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/GitHubActionsDotNet.Api/Models/WeatherForecast.cs b/src/GitHubActionsDotNet.Api/Models/WeatherForecast.cs index 786b4a10..67da0a38 100644 --- a/src/GitHubActionsDotNet.Api/Models/WeatherForecast.cs +++ b/src/GitHubActionsDotNet.Api/Models/WeatherForecast.cs @@ -10,3 +10,5 @@ public record WeatherForecast public string? Summary { get; init; } } + + From 54a2e25ab41960ab2c182940df0a042c8bef8505 Mon Sep 17 00:00:00 2001 From: Eris Jakupi Date: Mon, 1 Sep 2025 10:26:51 +0200 Subject: [PATCH 02/17] neues feature --- .github/workflows/pr-verify.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pr-verify.yml b/.github/workflows/pr-verify.yml index 3243ea4b..f7dc0454 100644 --- a/.github/workflows/pr-verify.yml +++ b/.github/workflows/pr-verify.yml @@ -19,3 +19,4 @@ jobs: - name: Build with dotnet run: dotnet build --configuration Release + From 5b5cb7ba15f6ca87baff3cf3589a72147c415f2f Mon Sep 17 00:00:00 2001 From: Eris Jakupi Date: Mon, 1 Sep 2025 11:16:09 +0200 Subject: [PATCH 03/17] add dotnet test to pr verify --- .github/workflows/pr-verify.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr-verify.yml b/.github/workflows/pr-verify.yml index f7dc0454..5f355b6a 100644 --- a/.github/workflows/pr-verify.yml +++ b/.github/workflows/pr-verify.yml @@ -19,4 +19,7 @@ jobs: - name: Build with dotnet run: dotnet build --configuration Release - + + - name: dotnet test + run: dotnet test --configuration Release --no-build + From b6cd1756b86d17b6d2c9278c31a0e1a0a4517119 Mon Sep 17 00:00:00 2001 From: Eris Jakupi Date: Mon, 1 Sep 2025 11:23:12 +0200 Subject: [PATCH 04/17] add failing test --- .../Models/WeatherForecastTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GitHubActionsDotNet.Api.Tests/Models/WeatherForecastTests.cs b/src/GitHubActionsDotNet.Api.Tests/Models/WeatherForecastTests.cs index f03d0f47..32811ed6 100644 --- a/src/GitHubActionsDotNet.Api.Tests/Models/WeatherForecastTests.cs +++ b/src/GitHubActionsDotNet.Api.Tests/Models/WeatherForecastTests.cs @@ -12,6 +12,6 @@ public void TemperatureFShouldReturnCorrectValueBasedOnTemperatureC() TemperatureC = 0 }; - weatherForecast.TemperatureF.Should().Be(32); + weatherForecast.TemperatureF.Should().Be(31); } } From 9d5396e0eaf67998374bc4b732d4031c04939525 Mon Sep 17 00:00:00 2001 From: Eris Jakupi Date: Mon, 1 Sep 2025 11:25:44 +0200 Subject: [PATCH 05/17] fix test --- .../Models/WeatherForecastTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GitHubActionsDotNet.Api.Tests/Models/WeatherForecastTests.cs b/src/GitHubActionsDotNet.Api.Tests/Models/WeatherForecastTests.cs index 32811ed6..f03d0f47 100644 --- a/src/GitHubActionsDotNet.Api.Tests/Models/WeatherForecastTests.cs +++ b/src/GitHubActionsDotNet.Api.Tests/Models/WeatherForecastTests.cs @@ -12,6 +12,6 @@ public void TemperatureFShouldReturnCorrectValueBasedOnTemperatureC() TemperatureC = 0 }; - weatherForecast.TemperatureF.Should().Be(31); + weatherForecast.TemperatureF.Should().Be(32); } } From 5d8353aeb4af01f9c98c81ec648905bf088acd42 Mon Sep 17 00:00:00 2001 From: Eris Jakupi Date: Tue, 2 Sep 2025 07:47:45 +0200 Subject: [PATCH 06/17] add dotnet format to pr verify --- .github/workflows/pr-verify.yml | 2 ++ global.json | 2 +- .../Models/WeatherForecastTests.cs | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr-verify.yml b/.github/workflows/pr-verify.yml index 5f355b6a..de3e9910 100644 --- a/.github/workflows/pr-verify.yml +++ b/.github/workflows/pr-verify.yml @@ -23,3 +23,5 @@ jobs: - name: dotnet test run: dotnet test --configuration Release --no-build + - name: dotnet format + run: dotnet format -v detailed --verify-no-changes \ No newline at end of file diff --git a/global.json b/global.json index 2ddda36c..93681ff8 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "8.0.0", + "version": "9.0.0", "rollForward": "latestMinor", "allowPrerelease": false } diff --git a/src/GitHubActionsDotNet.Api.Tests/Models/WeatherForecastTests.cs b/src/GitHubActionsDotNet.Api.Tests/Models/WeatherForecastTests.cs index f03d0f47..0897f893 100644 --- a/src/GitHubActionsDotNet.Api.Tests/Models/WeatherForecastTests.cs +++ b/src/GitHubActionsDotNet.Api.Tests/Models/WeatherForecastTests.cs @@ -12,6 +12,6 @@ public void TemperatureFShouldReturnCorrectValueBasedOnTemperatureC() TemperatureC = 0 }; - weatherForecast.TemperatureF.Should().Be(32); + weatherForecast.TemperatureF.Should().Be(32); } } From c9d3ebdd57f3bd936d3ed575720e56fe67646940 Mon Sep 17 00:00:00 2001 From: Eris Jakupi Date: Tue, 2 Sep 2025 07:53:05 +0200 Subject: [PATCH 07/17] changed .NET version to 9 --- .github/workflows/pr-verify.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-verify.yml b/.github/workflows/pr-verify.yml index de3e9910..9cc363f4 100644 --- a/.github/workflows/pr-verify.yml +++ b/.github/workflows/pr-verify.yml @@ -15,7 +15,7 @@ jobs: - name: Set up .NET Core uses: actions/setup-dotnet@v4 with: - dotnet-version: 8.0 + dotnet-version: 9.0 - name: Build with dotnet run: dotnet build --configuration Release From 5b4af6ffec78c6667a59131156047d86e9f95828 Mon Sep 17 00:00:00 2001 From: Eris Jakupi Date: Tue, 2 Sep 2025 07:54:44 +0200 Subject: [PATCH 08/17] switch back to .NET 8 --- .github/workflows/pr-verify.yml | 2 +- global.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr-verify.yml b/.github/workflows/pr-verify.yml index 9cc363f4..de3e9910 100644 --- a/.github/workflows/pr-verify.yml +++ b/.github/workflows/pr-verify.yml @@ -15,7 +15,7 @@ jobs: - name: Set up .NET Core uses: actions/setup-dotnet@v4 with: - dotnet-version: 9.0 + dotnet-version: 8.0 - name: Build with dotnet run: dotnet build --configuration Release diff --git a/global.json b/global.json index 93681ff8..2ddda36c 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "9.0.0", + "version": "8.0.0", "rollForward": "latestMinor", "allowPrerelease": false } From dab650eb5c6900a366e88babe37145aa5db1466a Mon Sep 17 00:00:00 2001 From: Eris Jakupi Date: Tue, 2 Sep 2025 07:56:36 +0200 Subject: [PATCH 09/17] fixed formatting --- .../Models/WeatherForecastTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GitHubActionsDotNet.Api.Tests/Models/WeatherForecastTests.cs b/src/GitHubActionsDotNet.Api.Tests/Models/WeatherForecastTests.cs index 0897f893..f03d0f47 100644 --- a/src/GitHubActionsDotNet.Api.Tests/Models/WeatherForecastTests.cs +++ b/src/GitHubActionsDotNet.Api.Tests/Models/WeatherForecastTests.cs @@ -12,6 +12,6 @@ public void TemperatureFShouldReturnCorrectValueBasedOnTemperatureC() TemperatureC = 0 }; - weatherForecast.TemperatureF.Should().Be(32); + weatherForecast.TemperatureF.Should().Be(32); } } From 8336c9b762bc0775b4e665a31b24764c932a0cb2 Mon Sep 17 00:00:00 2001 From: Eris Jakupi Date: Tue, 2 Sep 2025 08:01:07 +0200 Subject: [PATCH 10/17] test code ql --- src/GitHubActionsDotNet.Api.Tests/Models/WeatherForecastTests.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/GitHubActionsDotNet.Api.Tests/Models/WeatherForecastTests.cs b/src/GitHubActionsDotNet.Api.Tests/Models/WeatherForecastTests.cs index f03d0f47..78c1a4c1 100644 --- a/src/GitHubActionsDotNet.Api.Tests/Models/WeatherForecastTests.cs +++ b/src/GitHubActionsDotNet.Api.Tests/Models/WeatherForecastTests.cs @@ -13,5 +13,6 @@ public void TemperatureFShouldReturnCorrectValueBasedOnTemperatureC() }; weatherForecast.TemperatureF.Should().Be(32); + weatherForecast.TemperatureF.Should().Be(32); } } From ba93324e08af49372a4e40938d1ce539c7b324fd Mon Sep 17 00:00:00 2001 From: Eris Jakupi Date: Tue, 2 Sep 2025 08:55:36 +0200 Subject: [PATCH 11/17] add ci --- .github/workflows/ci.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..005911b2 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,24 @@ +name: CI + +on: + push: + branches: [ "main" ] + +jobs: + build: + name: CI + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Set up .NET Core + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 8.0 + + - name: Build with dotnet + run: dotnet build --configuration Release + + - name: dotnet publish + run: dotnet publish src/GitHubActionsDotNet.Api/GitHubActionsDotNet.Api.csproj --configuration Release -o artifacts From 35a7bfb1dba0d2226cd89ae98431388216561514 Mon Sep 17 00:00:00 2001 From: Eris Jakupi Date: Tue, 2 Sep 2025 09:07:56 +0200 Subject: [PATCH 12/17] upload artifacts as part of CI --- .github/workflows/ci.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 005911b2..d39dd033 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,3 +22,8 @@ jobs: - name: dotnet publish run: dotnet publish src/GitHubActionsDotNet.Api/GitHubActionsDotNet.Api.csproj --configuration Release -o artifacts + + - uses: actions/upload-artifact@v4 + with: + name: dometrain-artifact + path: artifacts/ \ No newline at end of file From 051ca6f6869ac5f8516950e0d4e1357a4d67ac24 Mon Sep 17 00:00:00 2001 From: Eris Jakupi Date: Fri, 5 Sep 2025 11:06:17 +0200 Subject: [PATCH 13/17] add cron job --- .github/workflows/cron.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 .github/workflows/cron.yml diff --git a/.github/workflows/cron.yml b/.github/workflows/cron.yml new file mode 100644 index 00000000..c879f2da --- /dev/null +++ b/.github/workflows/cron.yml @@ -0,0 +1,14 @@ +name: Run every minute + +on: + schedule: + - cron: '*/5 * * * *' + +jobs: + build: + name: PR Verify + runs-on: ubuntu-latest + + steps: + - name: Hello World + run: echo "Hello World" \ No newline at end of file From 52f1c35399db87efe55a14567559ceaf5b18678b Mon Sep 17 00:00:00 2001 From: Eris Jakupi Date: Fri, 5 Sep 2025 11:14:21 +0200 Subject: [PATCH 14/17] edited cron job --- .github/workflows/cron.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cron.yml b/.github/workflows/cron.yml index c879f2da..9e95155e 100644 --- a/.github/workflows/cron.yml +++ b/.github/workflows/cron.yml @@ -1,12 +1,12 @@ -name: Run every minute +name: Run every 5 minutes on: schedule: - cron: '*/5 * * * *' jobs: - build: - name: PR Verify + cron: + name: Run every 5 minutes runs-on: ubuntu-latest steps: From 8651f20958dc9921b678e72ac2237fe85a0ed8bb Mon Sep 17 00:00:00 2001 From: Eris Jakupi Date: Fri, 5 Sep 2025 12:54:53 +0200 Subject: [PATCH 15/17] added secrets branch --- .github/workflows/cron.yml | 2 +- .github/workflows/secrets.yml | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/secrets.yml diff --git a/.github/workflows/cron.yml b/.github/workflows/cron.yml index 9e95155e..87b0ca4e 100644 --- a/.github/workflows/cron.yml +++ b/.github/workflows/cron.yml @@ -2,7 +2,7 @@ name: Run every 5 minutes on: schedule: - - cron: '*/5 * * * *' + - cron: "*/5 * * * *" jobs: cron: diff --git a/.github/workflows/secrets.yml b/.github/workflows/secrets.yml new file mode 100644 index 00000000..b7fdd735 --- /dev/null +++ b/.github/workflows/secrets.yml @@ -0,0 +1,17 @@ +name: Secrets workflow +on: + pull_request: + branches: ["main"] + + +env: + API_CSPROJ_PATH: ".src/GithubActionsDotnet.Api/GithubActionsDotnet.Api.csproj " + +jobs: + secrets: + name: Secrets Demo + runs-on: ubuntu-latest + + steps: + - name: echo environment variable + run: echo "$API_CSPROJ_PATH" From e35613af69857ea8a0ab6fcb65d0240943b5f0ea Mon Sep 17 00:00:00 2001 From: Eris Jakupi Date: Fri, 5 Sep 2025 13:26:29 +0200 Subject: [PATCH 16/17] add a job --- .github/workflows/secrets.yml | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/.github/workflows/secrets.yml b/.github/workflows/secrets.yml index b7fdd735..b3d22ace 100644 --- a/.github/workflows/secrets.yml +++ b/.github/workflows/secrets.yml @@ -1,17 +1,27 @@ name: Secrets workflow + on: pull_request: branches: ["main"] - env: - API_CSPROJ_PATH: ".src/GithubActionsDotnet.Api/GithubActionsDotnet.Api.csproj " - + API_CSPROJ_PATH: "./src/GithubActionsDotnet.Api/GithubActionsDotnet.Api.csproj" + jobs: secrets: name: Secrets Demo runs-on: ubuntu-latest + env: + JOB_NAME: "secrets" + steps: + - name: Echo environment variable + run: echo "The value of $JOB_NAME is $API_CSPROJ_PATH" + new_job: + name: Secrets Demo + runs-on: ubuntu-latest + env: + JOB_NAME: "new_job" steps: - - name: echo environment variable - run: echo "$API_CSPROJ_PATH" + - name: Echo environment variable + run: echo "The value of $JOB_NAME is $API_CSPROJ_PATH" From c4ddacbc834c86e342bfffdae55d328125da87b9 Mon Sep 17 00:00:00 2001 From: Eris Jakupi Date: Mon, 8 Sep 2025 09:12:06 +0200 Subject: [PATCH 17/17] delete cron job --- .github/workflows/cron.yml | 14 -------------- .github/workflows/secrets.yml | 2 +- 2 files changed, 1 insertion(+), 15 deletions(-) delete mode 100644 .github/workflows/cron.yml diff --git a/.github/workflows/cron.yml b/.github/workflows/cron.yml deleted file mode 100644 index 87b0ca4e..00000000 --- a/.github/workflows/cron.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: Run every 5 minutes - -on: - schedule: - - cron: "*/5 * * * *" - -jobs: - cron: - name: Run every 5 minutes - runs-on: ubuntu-latest - - steps: - - name: Hello World - run: echo "Hello World" \ No newline at end of file diff --git a/.github/workflows/secrets.yml b/.github/workflows/secrets.yml index b3d22ace..f2b276d7 100644 --- a/.github/workflows/secrets.yml +++ b/.github/workflows/secrets.yml @@ -15,7 +15,7 @@ jobs: JOB_NAME: "secrets" steps: - name: Echo environment variable - run: echo "The value of $JOB_NAME is $API_CSPROJ_PATH" + run: curl -h API_KEY new_job: name: Secrets Demo