Made "github:pages:enable" action idempotent

Signed-off-by: Bogdan Nechyporenko <bnechyporenko@bol.com>
This commit is contained in:
Bogdan Nechyporenko
2025-03-14 22:12:13 +01:00
parent 85df833fe3
commit 11bc3e65f0
2 changed files with 20 additions and 10 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-scaffolder-backend-module-github': patch
---
Made "github:pages:enable" action idempotent
@@ -118,16 +118,21 @@ export function createGithubPagesEnableAction(options: {
`Attempting to enable GitHub Pages for ${owner}/${repo} with "${buildType}" build type, on source branch "${sourceBranch}" and source path "${sourcePath}"`,
);
await client.request('POST /repos/{owner}/{repo}/pages', {
owner: owner,
repo: repo,
build_type: buildType,
source: {
branch: sourceBranch,
path: sourcePath,
},
headers: {
'X-GitHub-Api-Version': '2022-11-28',
await ctx.checkpoint({
key: `enabled.github.pages.${owner}.${repo}`,
fn: async () => {
await client.request('POST /repos/{owner}/{repo}/pages', {
owner: owner,
repo: repo,
build_type: buildType,
source: {
branch: sourceBranch,
path: sourcePath,
},
headers: {
'X-GitHub-Api-Version': '2022-11-28',
},
});
},
});