diff --git a/.changeset/ten-dancers-drum.md b/.changeset/ten-dancers-drum.md new file mode 100644 index 0000000000..427c507c8c --- /dev/null +++ b/.changeset/ten-dancers-drum.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-scaffolder-backend-module-github': patch +--- + +Fixed issue with octokit call missing owner and repo when creating environment variables using github:environment:create action diff --git a/plugins/scaffolder-backend-module-github/src/actions/githubEnvironment.examples.test.ts b/plugins/scaffolder-backend-module-github/src/actions/githubEnvironment.examples.test.ts index 9d4395eb7a..0a9242627c 100644 --- a/plugins/scaffolder-backend-module-github/src/actions/githubEnvironment.examples.test.ts +++ b/plugins/scaffolder-backend-module-github/src/actions/githubEnvironment.examples.test.ts @@ -221,6 +221,8 @@ describe('github:environment:create examples', () => { mockOctokit.rest.actions.createEnvironmentVariable, ).toHaveBeenCalledWith({ repository_id: 'repoid', + owner: 'owner', + repo: 'repository', environment_name: 'envname', name: 'key1', value: 'val1', @@ -229,6 +231,8 @@ describe('github:environment:create examples', () => { mockOctokit.rest.actions.createEnvironmentVariable, ).toHaveBeenCalledWith({ repository_id: 'repoid', + owner: 'owner', + repo: 'repository', environment_name: 'envname', name: 'key2', value: 'val2', diff --git a/plugins/scaffolder-backend-module-github/src/actions/githubEnvironment.test.ts b/plugins/scaffolder-backend-module-github/src/actions/githubEnvironment.test.ts index a8d8c4ef2e..b0fa08dae4 100644 --- a/plugins/scaffolder-backend-module-github/src/actions/githubEnvironment.test.ts +++ b/plugins/scaffolder-backend-module-github/src/actions/githubEnvironment.test.ts @@ -240,6 +240,8 @@ describe('github:environment:create', () => { mockOctokit.rest.actions.createEnvironmentVariable, ).toHaveBeenCalledWith({ repository_id: 'repoid', + owner: 'owner', + repo: 'repository', environment_name: 'envname', name: 'key1', value: 'val1', @@ -248,6 +250,8 @@ describe('github:environment:create', () => { mockOctokit.rest.actions.createEnvironmentVariable, ).toHaveBeenCalledWith({ repository_id: 'repoid', + owner: 'owner', + repo: 'repository', environment_name: 'envname', name: 'key2', value: 'val2', diff --git a/plugins/scaffolder-backend-module-github/src/actions/githubEnvironment.ts b/plugins/scaffolder-backend-module-github/src/actions/githubEnvironment.ts index e821ff0cd6..f6542e3d83 100644 --- a/plugins/scaffolder-backend-module-github/src/actions/githubEnvironment.ts +++ b/plugins/scaffolder-backend-module-github/src/actions/githubEnvironment.ts @@ -187,6 +187,8 @@ export function createGithubEnvironmentAction(options: { for (const [key, value] of Object.entries(environmentVariables ?? {})) { await client.rest.actions.createEnvironmentVariable({ repository_id: repository.data.id, + owner: owner, + repo: repo, environment_name: name, name: key, value,