Skip to content

Create PR to add Bootstrap Identity to eng-azure-authorization#1256

Merged
kin0992 merged 20 commits intomainfrom
features/create-eng-azure-authorization-pr
Mar 2, 2026
Merged

Create PR to add Bootstrap Identity to eng-azure-authorization#1256
kin0992 merged 20 commits intomainfrom
features/create-eng-azure-authorization-pr

Conversation

@kin0992
Copy link
Copy Markdown
Contributor

@kin0992 kin0992 commented Jan 23, 2026

This pull request adds new functionality to the OctokitGitHubService for branch creation, file content retrieval, and file updates, along with comprehensive tests for these features. Additionally, it introduces a new TfvarsService for manipulating .tfvars files, including robust unit tests for its behavior. These changes enhance the CLI's GitHub integration and improve the handling of Terraform variable files.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Jan 23, 2026

🦋 Changeset detected

Latest commit: bf1872b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@pagopa/dx-cli Minor
docs Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new CLI use case to open a PR against pagopa/eng-azure-authorization by updating a subscription’s terraform.tfvars, extending the GitHub adapter to support branch/file operations, and documenting the required PAT permissions.

Changes:

  • Extend GitHubService + OctokitGitHubService with createBranch, getFileContent, and updateFile (with related tests).
  • Introduce TfvarsService for updating directory_readers.service_principals_name (with unit tests).
  • Add requestAzureAuthorization use case and tests; update PAT docs to include Contents permission.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
apps/website/docs/dx-cli/github-pat.md Documents Contents: Read and write permission needed for file read/update automation.
apps/cli/src/use-cases/request-azure-authorization.ts New use case implementing the “edit tfvars → branch → commit → PR” workflow.
apps/cli/src/use-cases/tests/request-azure-authorization.test.ts Unit tests covering success and failure paths for the new use case.
apps/cli/src/index.ts Wires TfvarsService and instantiates the new use case in the CLI bootstrap.
apps/cli/src/domain/tfvars.ts Defines tfvars domain errors, service interface, and zod schema for use case input.
apps/cli/src/domain/github.ts Extends GitHub domain API with branch creation, file read, and file update primitives.
apps/cli/src/domain/dependencies.ts Adds tfvarsService to the global dependency container.
apps/cli/src/domain/tests/data.ts Updates dependency mocks to include tfvarsService.
apps/cli/src/adapters/tfvars/index.ts Regex-based implementation for editing terraform.tfvars directory readers list.
apps/cli/src/adapters/tfvars/tests/index.test.ts Tests for tfvars parsing and update behavior (duplicates, invalid format, formatting).
apps/cli/src/adapters/octokit/index.ts Implements new GitHub operations via Octokit REST APIs.
apps/cli/src/adapters/octokit/tests/index.test.ts Tests for new Octokit adapter methods and error handling.

Comment thread apps/cli/src/domain/tfvars.ts Outdated
Comment thread apps/cli/src/domain/tfvars.ts Outdated
Comment thread apps/cli/src/use-cases/request-azure-authorization.ts Outdated
Comment thread apps/cli/src/index.ts Outdated
Comment thread apps/cli/src/use-cases/__tests__/request-azure-authorization.test.ts Outdated
Comment thread apps/cli/src/use-cases/__tests__/request-azure-authorization.test.ts Outdated
@kin0992 kin0992 force-pushed the features/create-eng-azure-authorization-pr branch from f0aacdd to 3fa6819 Compare January 26, 2026 09:44
@kin0992 kin0992 force-pushed the features/create-eng-azure-authorization-pr branch from 88455e1 to 9495312 Compare January 26, 2026 13:41
@kin0992
Copy link
Copy Markdown
Contributor Author

kin0992 commented Jan 26, 2026

Here is the outcome of the function: https://github.com/pagopa-dx/eng-azure-authorization/pull/3

@kin0992 kin0992 marked this pull request as ready for review January 26, 2026 15:15
@kin0992 kin0992 requested a review from a team as a code owner January 26, 2026 15:15
Comment thread apps/cli/src/use-cases/request-azure-authorization.ts Outdated
Comment thread apps/cli/src/use-cases/request-azure-authorization.ts Outdated
Comment thread apps/cli/src/use-cases/request-azure-authorization.ts Outdated
Comment thread apps/cli/src/use-cases/request-azure-authorization.ts Outdated
Comment thread apps/cli/src/use-cases/request-azure-authorization.ts Outdated
Comment thread apps/cli/src/domain/tfvars.ts Outdated
@kin0992 kin0992 force-pushed the features/create-eng-azure-authorization-pr branch 2 times, most recently from d8df03a to 324cc93 Compare January 27, 2026 14:27
@kin0992 kin0992 force-pushed the features/create-eng-azure-authorization-pr branch from 324cc93 to 50eddf1 Compare January 27, 2026 14:58
@kin0992 kin0992 requested a review from lucacavallaro January 27, 2026 16:52
@kin0992 kin0992 force-pushed the features/create-eng-azure-authorization-pr branch from b6fee57 to 32633bb Compare January 28, 2026 15:08
@kin0992 kin0992 force-pushed the features/create-eng-azure-authorization-pr branch from 32633bb to c268b1f Compare February 2, 2026 09:10
@kin0992 kin0992 force-pushed the features/create-eng-azure-authorization-pr branch from 024c012 to dacd7d5 Compare February 6, 2026 10:25
Comment thread apps/cli/src/use-cases/request-azure-authorization.ts Outdated
@github-actions
Copy link
Copy Markdown
Contributor

Azure Static Web Apps: Your stage site is ready! Visit it here: https://proud-mud-0405c6703-1256.westeurope.1.azurestaticapps.net

Comment thread apps/cli/src/domain/github.ts
Comment thread apps/cli/src/adapters/octokit/__tests__/index.test.ts
@kin0992 kin0992 merged commit 907253d into main Mar 2, 2026
10 checks passed
@kin0992 kin0992 deleted the features/create-eng-azure-authorization-pr branch March 2, 2026 08:53
kin0992 added a commit that referenced this pull request Mar 23, 2026
After workspace initialization, the `init` command now automatically
requests Azure authorization for each newly initialized cloud account by
creating a PR on `eng-azure-authorization` to add the bootstrap identity
to directory readers.

This wires the `requestAuthorization` use case (introduced in #1256)
into the init flow.

Closes CES-1522

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants