Hopefully fix SS13 repo sync

This commit is contained in:
Jordan Dominion
2024-08-11 08:33:27 -04:00
parent c0c286ab56
commit 3d5d2319af
2 changed files with 36 additions and 6 deletions
+26 -1
View File
@@ -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
+10 -5
View File
@@ -135,7 +135,7 @@ namespace Tgstation.Server.ReleaseNotes
return 454233;
}
await GenerateAppCredentials(client, args[1]);
await GenerateAppCredentials(client, args[1], false);
return await EnsureRelease(client);
}
@@ -171,7 +171,8 @@ namespace Tgstation.Server.ReleaseNotes
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 @@ package (version) distribution(s); urgency=urgency
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 @@ package (version) distribution(s); urgency=urgency
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 @@ package (version) distribution(s); urgency=urgency
static async ValueTask<int> 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)
{