diff --git a/.github/workflows/update-ss13-org-mirror.yml b/.github/workflows/update-ss13-org-mirror.yml index e8dabd987e4..c5db334d7f5 100644 --- a/.github/workflows/update-ss13-org-mirror.yml +++ b/.github/workflows/update-ss13-org-mirror.yml @@ -23,11 +23,36 @@ jobs: dotnet-version: '${{ env.TGS_DOTNET_VERSION }}.0.x' dotnet-quality: ${{ env.TGS_DOTNET_QUALITY }} - - name: Checkout + - name: Build Checkout + uses: actions/checkout@v4 + with: + path: temp_workspace + + - name: Restore + run: | + cd temp_workspace + dotnet restore + + - name: Build ReleaseNotes + run: | + cd temp_workspace + dotnet build -c Release -p:TGS_HOST_NO_WEBPANEL=true tools/Tgstation.Server.ReleaseNotes/Tgstation.Server.ReleaseNotes.csproj + + - name: Generate App Token + run: | + cd temp_workspace + dotnet run -c Release --no-build --project tools/Tgstation.Server.ReleaseNotes --token-output-file ${{ runner.temp }}/installation_secret.txt ${{ secrets.TGS_CI_GITHUB_APP_TOKEN_BASE64 }} --spacestation13 + echo "INSTALLATION_TOKEN=$(cat ${{ runner.temp }}/installation_secret.txt)" >> $GITHUB_ENV + rm ${{ runner.temp }}/installation_secret.txt + env: + TGS_RELEASE_NOTES_TOKEN: ${{ secrets.DEV_PUSH_TOKEN }} + + - name: Main Checkout uses: actions/checkout@v4 with: fetch-depth: 0 fetch-tags: true + token: ${{ env.INSTALLATION_TOKEN }} - name: Restore run: dotnet restore diff --git a/tools/Tgstation.Server.ReleaseNotes/Program.cs b/tools/Tgstation.Server.ReleaseNotes/Program.cs index b3856534865..26247c8d012 100644 --- a/tools/Tgstation.Server.ReleaseNotes/Program.cs +++ b/tools/Tgstation.Server.ReleaseNotes/Program.cs @@ -135,7 +135,7 @@ static async Task Main(string[] args) return 454233; } - await GenerateAppCredentials(client, args[1]); + await GenerateAppCredentials(client, args[1], false); return await EnsureRelease(client); } @@ -171,7 +171,8 @@ static async Task Main(string[] args) return 33847; } - await GenerateAppCredentials(client, args[2]); + bool toSS13 = args.Length > 3 && args[3].Equals("--spacestation13", StringComparison.OrdinalIgnoreCase); + await GenerateAppCredentials(client, args[2], true); var token = client.Credentials.GetToken(); var destPath = args[1]; @@ -1640,7 +1641,7 @@ [optional blank line(s), stripped] return 0; } - static async ValueTask GenerateAppCredentials(GitHubClient gitHubClient, string pemBase64) + static async ValueTask GenerateAppCredentials(GitHubClient gitHubClient, string pemBase64, bool toSS13) { var pemBytes = Convert.FromBase64String(pemBase64); var pem = Encoding.UTF8.GetString(pemBytes); @@ -1665,7 +1666,11 @@ static async ValueTask GenerateAppCredentials(GitHubClient gitHubClient, string gitHubClient.Credentials = new Credentials(jwtStr, AuthenticationType.Bearer); - var installation = await gitHubClient.GitHubApps.GetRepositoryInstallationForCurrent(RepoOwner, RepoName); + var installation = await gitHubClient.GitHubApps.GetRepositoryInstallationForCurrent( + toSS13 + ? "spacestation13" + : RepoOwner, + RepoName); var installToken = await gitHubClient.GitHubApps.CreateInstallationToken(installation.Id); gitHubClient.Credentials = new Credentials(installToken.Token); @@ -1673,7 +1678,7 @@ static async ValueTask GenerateAppCredentials(GitHubClient gitHubClient, string static async ValueTask CICompletionCheck(GitHubClient gitHubClient, string currentSha, string pemBase64) { - await GenerateAppCredentials(gitHubClient, pemBase64); + await GenerateAppCredentials(gitHubClient, pemBase64, false); await gitHubClient.Check.Run.Create(RepoOwner, RepoName, new NewCheckRun("CI Completion", currentSha) {