Skip to content

Commit

Permalink
Updated to latest bits using the pat token for linting
Browse files Browse the repository at this point in the history
  • Loading branch information
david-driscoll committed Nov 21, 2023
1 parent c2ad577 commit 640879e
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 19 deletions.
7 changes: 1 addition & 6 deletions .build/Build.CI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
[GitHubActionsInput("THIS_IS_ANOTHER_INPUT" /*, Alias = "ThisIsAInput"*/)]
[GitHubActionsEnvironmentVariable("THIS_IS_A_ENV" /*, Alias = "ThisIsAEnv"*/, Default = "'test'")]
[GitHubActionsSecret("THIS_IS_A_SECRET" /*, Alias = "ThisIsASecret"*/)]
[GitHubActionsSecret("RSG_BOT_TOKEN", Alias = "PatToken")]
[GitHubActionsSecret("RSG_BOT_TOKEN")]
[PrintBuildVersion]
[PrintCIEnvironment]
[UploadLogs]
Expand Down Expand Up @@ -100,11 +100,6 @@ public static RocketSurgeonGitHubActionsConfiguration CiIgnoreMiddleware(RocketS
[Parameter(Name = "THIS_IS_A_VARIABLE")] public string ThisIsAVariable { get; set; }
[Parameter] public string ThisIsAEnv { get; set; }
[Parameter] public string ThisIsASecret { get; set; }
[Parameter] public string PatToken { get; set; }
#pragma warning disable CA1033
string ICanLintStagedFiles.LintStagedGithubToken => PatToken;
#pragma warning restore CA1033
#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.

public static RocketSurgeonGitHubActionsConfiguration CiMiddleware(RocketSurgeonGitHubActionsConfiguration configuration)
{
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,19 +128,19 @@ jobs:
- name: 🎁 Restore
id: restore
run: |
dotnet nuke Restore --skip --thisisaothervariable '${{ vars.THIS_IS_A_VARIABLE }}' --thisisanothervariable '${{ vars.THIS_IS_ANOTHER_VARIABLE }}' --this_is_a_variable '${{ vars.THIS_IS_A_VARIABLE }}' --thisisaenv '${{ env.THIS_IS_A_ENV || 'test' }}' --thisisasecret '${{ secrets.THIS_IS_A_SECRET }}' --pattoken '${{ secrets.RSG_BOT_TOKEN }}' --githubtoken '${{ secrets.GITHUB_TOKEN }}'
dotnet nuke Restore --skip --thisisaothervariable '${{ vars.THIS_IS_A_VARIABLE }}' --thisisanothervariable '${{ vars.THIS_IS_ANOTHER_VARIABLE }}' --this_is_a_variable '${{ vars.THIS_IS_A_VARIABLE }}' --thisisaenv '${{ env.THIS_IS_A_ENV || 'test' }}' --thisisasecret '${{ secrets.THIS_IS_A_SECRET }}' --githubtoken '${{ secrets.GITHUB_TOKEN }}'
- name: ⚙ Build
id: build
run: |
dotnet nuke Build --skip --thisisaothervariable '${{ vars.THIS_IS_A_VARIABLE }}' --thisisanothervariable '${{ vars.THIS_IS_ANOTHER_VARIABLE }}' --this_is_a_variable '${{ vars.THIS_IS_A_VARIABLE }}' --thisisaenv '${{ env.THIS_IS_A_ENV || 'test' }}' --thisisasecret '${{ secrets.THIS_IS_A_SECRET }}' --pattoken '${{ secrets.RSG_BOT_TOKEN }}' --githubtoken '${{ secrets.GITHUB_TOKEN }}'
dotnet nuke Build --skip --thisisaothervariable '${{ vars.THIS_IS_A_VARIABLE }}' --thisisanothervariable '${{ vars.THIS_IS_ANOTHER_VARIABLE }}' --this_is_a_variable '${{ vars.THIS_IS_A_VARIABLE }}' --thisisaenv '${{ env.THIS_IS_A_ENV || 'test' }}' --thisisasecret '${{ secrets.THIS_IS_A_SECRET }}' --githubtoken '${{ secrets.GITHUB_TOKEN }}'
- name: 🚦 Test
id: test
run: |
dotnet nuke Test TriggerCodeCoverageReports GenerateCodeCoverageReportCobertura GenerateCodeCoverageBadges GenerateCodeCoverageSummary GenerateCodeCoverageReport --skip --thisisaothervariable '${{ vars.THIS_IS_A_VARIABLE }}' --thisisanothervariable '${{ vars.THIS_IS_ANOTHER_VARIABLE }}' --this_is_a_variable '${{ vars.THIS_IS_A_VARIABLE }}' --thisisaenv '${{ env.THIS_IS_A_ENV || 'test' }}' --thisisasecret '${{ secrets.THIS_IS_A_SECRET }}' --pattoken '${{ secrets.RSG_BOT_TOKEN }}' --githubtoken '${{ secrets.GITHUB_TOKEN }}'
dotnet nuke Test TriggerCodeCoverageReports GenerateCodeCoverageReportCobertura GenerateCodeCoverageBadges GenerateCodeCoverageSummary GenerateCodeCoverageReport --skip --thisisaothervariable '${{ vars.THIS_IS_A_VARIABLE }}' --thisisanothervariable '${{ vars.THIS_IS_ANOTHER_VARIABLE }}' --this_is_a_variable '${{ vars.THIS_IS_A_VARIABLE }}' --thisisaenv '${{ env.THIS_IS_A_ENV || 'test' }}' --thisisasecret '${{ secrets.THIS_IS_A_SECRET }}' --githubtoken '${{ secrets.GITHUB_TOKEN }}'
- name: 📦 Pack
id: pack
run: |
dotnet nuke Pack --skip --thisisaothervariable '${{ vars.THIS_IS_A_VARIABLE }}' --thisisanothervariable '${{ vars.THIS_IS_ANOTHER_VARIABLE }}' --this_is_a_variable '${{ vars.THIS_IS_A_VARIABLE }}' --thisisaenv '${{ env.THIS_IS_A_ENV || 'test' }}' --thisisasecret '${{ secrets.THIS_IS_A_SECRET }}' --pattoken '${{ secrets.RSG_BOT_TOKEN }}' --githubtoken '${{ secrets.GITHUB_TOKEN }}'
dotnet nuke Pack --skip --thisisaothervariable '${{ vars.THIS_IS_A_VARIABLE }}' --thisisanothervariable '${{ vars.THIS_IS_ANOTHER_VARIABLE }}' --this_is_a_variable '${{ vars.THIS_IS_A_VARIABLE }}' --thisisaenv '${{ env.THIS_IS_A_ENV || 'test' }}' --thisisasecret '${{ secrets.THIS_IS_A_SECRET }}' --githubtoken '${{ secrets.GITHUB_TOKEN }}'
- name: 🏺 Publish coverage data
if: always()
uses: actions/upload-artifact@v3.1.3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/inputs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,4 @@ jobs:
- name: With Outputs
id: withOutputs
run: |
dotnet nuke WithOutputs --skip --thisisainput '${{ inputs.THIS_IS_A_INPUT }}' --thisisaothervariable '${{ vars.THIS_IS_A_VARIABLE }}' --thisisanothervariable '${{ vars.THIS_IS_ANOTHER_VARIABLE }}' --this_is_a_variable '${{ vars.THIS_IS_A_VARIABLE }}' --thisisaenv '${{ env.THIS_IS_A_ENV || 'test' }}' --thisisasecret '${{ secrets.THIS_IS_A_SECRET }}' --pattoken '${{ secrets.RSG_BOT_TOKEN }}' --githubtoken '${{ secrets.GITHUB_TOKEN }}'
dotnet nuke WithOutputs --skip --thisisainput '${{ inputs.THIS_IS_A_INPUT }}' --thisisaothervariable '${{ vars.THIS_IS_A_VARIABLE }}' --thisisanothervariable '${{ vars.THIS_IS_ANOTHER_VARIABLE }}' --this_is_a_variable '${{ vars.THIS_IS_A_VARIABLE }}' --thisisaenv '${{ env.THIS_IS_A_ENV || 'test' }}' --thisisasecret '${{ secrets.THIS_IS_A_SECRET }}' --githubtoken '${{ secrets.GITHUB_TOKEN }}'
5 changes: 3 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ jobs:
token: '${{ secrets.RSG_BOT_TOKEN }}'
repository: '${{ github.event.pull_request.head.repo.full_name }}'
ref: '${{ github.event.pull_request.head.ref }}'
token: '${{ secrets.RSG_BOT_TOKEN }}'
clean: 'false'
fetch-depth: '0'
- name: 🔨 Use .NET Core 6.0 SDK
Expand All @@ -68,12 +69,12 @@ jobs:
id: regenerateBuildConfigurations
if: github.event.pull_request.user.login != 'renovate[bot]' && github.event.pull_request.user.login != 'dependabot[bot]'
run: |
dotnet nuke RegenerateBuildConfigurations --skip --thisisaothervariable '${{ vars.THIS_IS_A_VARIABLE }}' --thisisanothervariable '${{ vars.THIS_IS_ANOTHER_VARIABLE }}' --this_is_a_variable '${{ vars.THIS_IS_A_VARIABLE }}' --thisisaenv '${{ env.THIS_IS_A_ENV || 'test' }}' --thisisasecret '${{ secrets.THIS_IS_A_SECRET }}' --pattoken '${{ secrets.RSG_BOT_TOKEN }}' --githubtoken '${{ secrets.GITHUB_TOKEN }}'
dotnet nuke RegenerateBuildConfigurations --skip --thisisaothervariable '${{ vars.THIS_IS_A_VARIABLE }}' --thisisanothervariable '${{ vars.THIS_IS_ANOTHER_VARIABLE }}' --this_is_a_variable '${{ vars.THIS_IS_A_VARIABLE }}' --thisisaenv '${{ env.THIS_IS_A_ENV || 'test' }}' --thisisasecret '${{ secrets.THIS_IS_A_SECRET }}' --githubtoken '${{ secrets.GITHUB_TOKEN }}'
- name: Lint Staged
id: lintStaged
if: github.event.pull_request.user.login != 'renovate[bot]' && github.event.pull_request.user.login != 'dependabot[bot]'
run: |
dotnet nuke LintStaged --skip --thisisaothervariable '${{ vars.THIS_IS_A_VARIABLE }}' --thisisanothervariable '${{ vars.THIS_IS_ANOTHER_VARIABLE }}' --this_is_a_variable '${{ vars.THIS_IS_A_VARIABLE }}' --thisisaenv '${{ env.THIS_IS_A_ENV || 'test' }}' --thisisasecret '${{ secrets.THIS_IS_A_SECRET }}' --pattoken '${{ secrets.RSG_BOT_TOKEN }}' --githubtoken '${{ secrets.GITHUB_TOKEN }}'
dotnet nuke LintStaged --skip --thisisaothervariable '${{ vars.THIS_IS_A_VARIABLE }}' --thisisanothervariable '${{ vars.THIS_IS_ANOTHER_VARIABLE }}' --this_is_a_variable '${{ vars.THIS_IS_A_VARIABLE }}' --thisisaenv '${{ env.THIS_IS_A_ENV || 'test' }}' --thisisasecret '${{ secrets.THIS_IS_A_SECRET }}' --githubtoken '${{ secrets.GITHUB_TOKEN }}'
- name: Add & Commit
if: github.event.pull_request.user.login != 'renovate[bot]' && github.event.pull_request.user.login != 'dependabot[bot]'
uses: stefanzweifel/git-auto-commit-action@v5
Expand Down
3 changes: 0 additions & 3 deletions .nuke/build.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,6 @@
"type": "string",
"description": "Partition to use on CI"
},
"PatToken": {
"type": "string"
},
"Plan": {
"type": "boolean",
"description": "Shows the execution plan (HTML)"
Expand Down
9 changes: 9 additions & 0 deletions src/Nuke/GithubActions/GitHubActionsLintAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ params string[] images
{
}

/// <summary>
/// The PAT token that is used to access the repository
/// </summary>
/// <remarks>
/// Should be in the format of the name of the secret eg RSG_BOT_TOKEN
/// </remarks>
public string TokenSecret { get; set; } = "RSG_BOT_TOKEN";

Check warning on line 52 in src/Nuke/GithubActions/GitHubActionsLintAttribute.cs

View workflow job for this annotation

GitHub Actions / lint

Check warning on line 52 in src/Nuke/GithubActions/GitHubActionsLintAttribute.cs

View workflow job for this annotation

GitHub Actions / lint

Check warning on line 52 in src/Nuke/GithubActions/GitHubActionsLintAttribute.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Check warning on line 52 in src/Nuke/GithubActions/GitHubActionsLintAttribute.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Check warning on line 52 in src/Nuke/GithubActions/GitHubActionsLintAttribute.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Check warning on line 52 in src/Nuke/GithubActions/GitHubActionsLintAttribute.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Check warning on line 52 in src/Nuke/GithubActions/GitHubActionsLintAttribute.cs

View check run for this annotation

Codecov / codecov/patch

src/Nuke/GithubActions/GitHubActionsLintAttribute.cs#L52

Added line #L52 was not covered by tests

Check warning on line 52 in src/Nuke/GithubActions/GitHubActionsLintAttribute.cs

View workflow job for this annotation

GitHub Actions / build (macos-latest)

Check warning on line 52 in src/Nuke/GithubActions/GitHubActionsLintAttribute.cs

View workflow job for this annotation

GitHub Actions / build (macos-latest)

Check warning on line 52 in src/Nuke/GithubActions/GitHubActionsLintAttribute.cs

View workflow job for this annotation

GitHub Actions / build (macos-latest)

Check warning on line 52 in src/Nuke/GithubActions/GitHubActionsLintAttribute.cs

View workflow job for this annotation

GitHub Actions / build (macos-latest)

Check warning on line 52 in src/Nuke/GithubActions/GitHubActionsLintAttribute.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

Check warning on line 52 in src/Nuke/GithubActions/GitHubActionsLintAttribute.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

Check warning on line 52 in src/Nuke/GithubActions/GitHubActionsLintAttribute.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

Check warning on line 52 in src/Nuke/GithubActions/GitHubActionsLintAttribute.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)


/// <inheritdoc />
public override ConfigurationEntity GetConfiguration(IReadOnlyCollection<ExecutableTarget> relevantTargets)
{
Expand All @@ -63,6 +71,7 @@ public override ConfigurationEntity GetConfiguration(IReadOnlyCollection<Executa
.ConfigureStep<CheckoutStep>(
step =>
{
step.Token = "${{ secrets.RSG_BOT_TOKEN }}";

Check warning on line 74 in src/Nuke/GithubActions/GitHubActionsLintAttribute.cs

View check run for this annotation

Codecov / codecov/patch

src/Nuke/GithubActions/GitHubActionsLintAttribute.cs#L74

Added line #L74 was not covered by tests
step.FetchDepth = 0;
step.Repository = "${{ github.event.pull_request.head.repo.full_name }}";
step.Ref = "${{ github.event.pull_request.head.ref }}";
Expand Down
2 changes: 0 additions & 2 deletions src/Nuke/ICanLintStagedFiles.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ namespace Rocket.Surgery.Nuke;
/// </remarks>
public interface ICanLintStagedFiles : INukeBuild
{
string LintStagedGithubToken { get; }

/// <summary>
/// Run staged lint tasks
/// </summary>
Expand Down
1 change: 0 additions & 1 deletion src/Nuke/PublicAPI.Shipped.txt
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,6 @@ Rocket.Surgery.Nuke.ICanLint.Lint.get -> Nuke.Common.Target!
Rocket.Surgery.Nuke.ICanLint.PostLint.get -> Nuke.Common.Target!
Rocket.Surgery.Nuke.ICanLintStagedFiles
Rocket.Surgery.Nuke.ICanLintStagedFiles.LintStaged.get -> Nuke.Common.Target!
Rocket.Surgery.Nuke.ICanLintStagedFiles.LintStagedGithubToken.get -> string!
Rocket.Surgery.Nuke.ICanPrettier
Rocket.Surgery.Nuke.ICanPrettier.Prettier.get -> Nuke.Common.Target!
Rocket.Surgery.Nuke.ICanRegenerateBuildConfiguration
Expand Down

0 comments on commit 640879e

Please sign in to comment.