Skip to content

feat: automate issue creation#53

Open
britneywwc wants to merge 15 commits into
mainfrom
automated-pr
Open

feat: automate issue creation#53
britneywwc wants to merge 15 commits into
mainfrom
automated-pr

Conversation

@britneywwc

@britneywwc britneywwc commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

Done

  • Remove dryRun flag and deprecated Copilot CLI check
  • Runs parser and creates issue on default
  • Takes in parseOnly flag that creates a parser without creating issue
  • Added issue creation automation. Parsed output is pushed to a remote branch that is referenced in the issue description
  • Overall workflow:
    1. Bauer parses doc
    2. Creates parsed output suggestions
    3. Pushes suggestions to a remote branch
    4. Creates issue description with reference to the remote branch
    5. MANUALLY assign copilot to the issue (Note: this is a temporary solution as there is a separate ticket for this)
    6. PR created automatically

QA

  • Clone the repository and build it locally with task build
  • Set up GH CLI
    • Note: This part will be phased out with API implementation
  • Run the project on parse only mode (with --parse-only flag)
    ./bauer --doc-id "1WJ-N_Xkkx4r_6knxW7h200oIDyi4mVMzgh1xYt5xaU0" \
    --github-repo <your-forked-repo>/canonical.com \
    --credentials ./credentials.json \
    --parse-only
    
    • See that no issue is created
    • Parser output is created locally in bauer-parse-output.json
  • Run the project on default mode (with issue creation)
    ./bauer --doc-id "1WJ-N_Xkkx4r_6knxW7h200oIDyi4mVMzgh1xYt5xaU0" \
    --github-repo <your-forked-repo>/canonical.com \
    --credentials ./credentials.json
    
    • Validate that the issue is created
    • Check that the remote SHA branch for the output file is referenced as expected
    • See that issue is created
    • MANUALLY assign to Copilot, and a PR is created to work on it
  • Example issue
  • Example PR

Issue / Card

Fixes WD-34220 and WD-37091

Screenshots

[If relevant, please include a screenshot.]

@britneywwc britneywwc changed the title feat: automate issue and PR creation feat: automate issue creation Jun 9, 2026
@britneywwc britneywwc requested a review from petesfrench June 9, 2026 09:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR shifts Bauer from “run Copilot locally / create PR” toward an automated parse → push parse JSON to a branch → create a GitHub issue workflow, with a --parse-only mode to skip GitHub operations.

Changes:

  • Removes the prior dry-run/Copilot CLI execution path and introduces parse-first workflow behavior (parse-only vs parse-and-issue).
  • Adds GitHub automation helpers (commit specific files, push branch, create issues via gh, remote PR helper).
  • Updates prompt/description generation and README/docs to reflect the new execution modes and GH CLI auth.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
README.md Updates CLI usage, flags table, and documents parse-only vs parse-and-issue + GH auth.
internal/workflow/workflow.go Reworks workflow to always parse first, then (optionally) push JSON to a branch and create an issue.
internal/workflow/api.go Updates API request/validation and response messaging for parse-only vs parse-and-issue.
internal/prompt/README.md Updates prompt docs to note shared issue/PR description usage.
internal/prompt/pr_description.go Adds embedded PR/issue description rendering + JSON chunking helpers.
internal/prompt/pr_description_test.go Adds tests asserting template references in generated PR description.
internal/orchestrator/orchestrator.go Removes Copilot execution; keeps extraction/prompt generation pipeline with parse-only behavior.
internal/github/repo.go Adds CommitFiles and GetHeadCommitSHA helpers used by the workflow.
internal/github/remote_pr.go Adds remote branch/file/PR creation helper via gh api (no local clone).
internal/github/issue.go Adds issue creation + comment helpers via gh issue.
internal/copilotcli/client.go Deletes Copilot SDK client implementation (no longer used).
internal/config/config.go Removes DryRun/Model fields; config now centers on parse-only + prompt generation inputs.
internal/config/cli.go Removes dry-run/model flags; introduces/renames parse-only flag.
cmd/bauer/main.go Updates CLI flags/output to support issue creation instead of PR creation.
cmd/app/types/config.go Removes model fields from app API config.
Comments suppressed due to low confidence (1)

cmd/app/types/config.go:20

  • APIConfig removed Model/SummaryModel, but the v1 API handler still references rc.APIConfig.Model/SummaryModel when building a config.Config (see cmd/app/v1/api.go). This will not compile until that code path is updated.
type APIConfig struct {
	// CredentialsPath is the path to the Google Cloud service account JSON key file.
	CredentialsPath string

	// OutputDir is the directory where generated prompt files will be saved.
	// Default is "bauer-output" if not specified.
	BaseOutputDir string

	// TargetRepo is the path (relative or absolute) to the target repository
	// where tasks should be executed. If not specified, uses the current directory.
	TargetRepo string `json:"target_repo"`
}

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/workflow/workflow.go
Comment thread internal/workflow/api.go
Comment thread internal/orchestrator/orchestrator.go Outdated
Comment thread internal/prompt/pr_description.go
Comment thread internal/config/cli.go Outdated
Comment thread internal/config/cli.go Outdated
Comment thread internal/config/config.go
@petesfrench

petesfrench commented Jun 10, 2026

Copy link
Copy Markdown

I ran it on Copy of canonical.com/ceph/support and there was a lot of noise for areas that don't have suggestions in the bau-doc-suggestions.json. Here is a snippet:

    {
      "id": "suggest.va7ijz9uih4d",
      "anchor": {
        "preceding_text": "n screenshots to view the templated section used on a live site. \nDon’t overth",
        "following_text": "  via the ribbon menu:\n\n\n\nThere are two automations under 🛠️Webpage templat"
      },
      "change": {
        "type": "insert",
        "new_text": " "
      },
      "verification": {
        "text_before_change": "n screenshots to view the templated section used on a live site. \nDon’t overth  via the ribbon menu:\n\n\n\nThere are two automations under 🛠️Webpage templat",
        "text_after_change": "n screenshots to view the templated section used on a live site. \nDon’t overth   via the ribbon menu:\n\n\n\nThere are two automations under 🛠️Webpage templat"
      },
      "location": {
        "section": "Body",
        "parent_heading": "Build with automations",
        "heading_level": 2,
        "in_table": true,
        "table": {
          "table_index": 9,
          "table_id": "table-9",
          "table_title": "",
          "row_index": 5,
          "column_index": 5,
          "column_header": "",
          "row_header": ""
        },
        "in_metadata": false
      },
      "position": {
        "start_index": 394,
        "end_index": 395
      }
    },
    ```
    And the CLI logs:
    ```
    2026/06/10 16:28:30 INFO Fetching document content... doc_id=1C2Rfz3P3YybgCpqM_-y_Ih8hvpyiRSkZHDLwO8Cpu4M
Fetching document 1C2Rfz3P3YybgCpqM_-y_Ih8hvpyiRSkZHDLwO8Cpu4M...
2026/06/10 16:28:36 INFO Document fetched successfully title="Copy of canonical.com/ceph/support" document_id=1C2Rfz3P3YybgCpqM_-y_Ih8hvpyiRSkZHDLwO8Cpu4M
Successfully fetched document: Copy of canonical.com/ceph/support
2026/06/10 16:28:36 INFO Suggestions extracted count=91
2026/06/10 16:28:36 INFO Document structure built headings=32 tables=76
2026/06/10 16:28:36 INFO Extracted actionable suggestions field_count=89
2026/06/10 16:28:36 INFO Grouped actionable suggestions location_groups=21
2026/06/10 16:28:36 INFO Extraction complete output_file=bauer-doc-suggestions.json extraction_duration=5.767147653s
2026/06/10 16:28:36 INFO Parse-only mode: returning early after extraction suggestion_count=89 file_count=15 total_duration=5.769781238s
2026/06/10 16:28:36 INFO workflow: parse-only mode complete output_file=/home/peter.french@canonical.com/canonical/projects/Bauer/bauer-output/bauer-parse-result.json
Status: success

@petesfrench

Copy link
Copy Markdown
  • Are you planning to move some of the more generic instructions (Vanilla guidelines, execution notes) into a custom agent?
  • Can we make the naming in credentials.json more clear? For example private_key_id - what is this a private key for
  • Once this is a service we will still have to run it from CLI?
  • This will create a lot of branches, what will the cleanup for this look like?
  • Is there a way to prevent duplication? For example, if additional changes are added to the same doc and a separate request is made, should it update the already existing branch? should it make a new branch with a duplication of the unresolved suggestions?

@petesfrench

Copy link
Copy Markdown

I ran on doc 1WJ-N_Xkkx4r_6knxW7h200oIDyi4mVMzgh1xYt5xaU0 and had some interesting results.

The issues created/jsons look the same: My issue & your issue

But our PRs were drastically different, with the description of mine halucinating changes that weren't suggested or made: My PR & your PR (yours also added a test that isn't needed)

@britneywwc

Copy link
Copy Markdown
Collaborator Author

I ran it on Copy of canonical.com/ceph/support and there was a lot of noise for areas that don't have suggestions in the bau-doc-suggestions.json.

Looking at the CLI logs, it seems like you did not pass the tab ID for the doc. This is the new copy doc 2.0 template so so we would have to pass in the tab ID for the page as well. If no tab ID is passed, it will pick up changes from the other instruction pages.

Can you try running it again with the tab ID?

--doc-id "1C2Rfz3P3YybgCpqM_-y_Ih8hvpyiRSkZHDLwO8Cpu4M/edit?tab=t.ly9ghy9ilvf"

@britneywwc

britneywwc commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator Author
  • Are you planning to move some of the more generic instructions (Vanilla guidelines, execution notes) into a custom agent?

Can you clarify what you mean by custom agent? The instructions are embedded in the prompt engine, so the engine carries the MD instruction files inside the binary executable.

  • Once this is a service we will still have to run it from CLI?

No, it will be an API service. We will pass in the values from the API call. For example, Jira webhook will call the endpoint with doc ID credentials, repository URL and so on.

  • This will create a lot of branches, what will the cleanup for this look like?

I was thinking of creating a workflow to delete the branches once it's merged

  • Is there a way to prevent duplication? For example, if additional changes are added to the same doc and a separate request is made, should it update the already existing branch? should it make a new branch with a duplication of the unresolved suggestions?

Ideally, we would only have one request at a time for the copy doc. With the current workflow logic, it will create a new branch with a duplication of unresolved suggestions. Whichever ticket runs Bauer, it will implement all unresolved suggestions on a copy doc.

To reduce duplication, maybe this could be something that can be discussed with the BAU panel/PMs. Wdyt?

  • * Can we make the naming in credentials.json more clear? For example private_key_id - what is this a private key for

Good call, will do!

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 20 out of 20 changed files in this pull request and generated 7 comments.

Comment thread internal/gdocs/credentials.go
Comment thread internal/gdocs/credentials.go
Comment thread internal/gdocs/service.go Outdated
Comment thread internal/github/repo.go
Comment thread internal/workflow/workflow.go Outdated
Comment thread internal/github/remote_pr.go Outdated
Comment thread internal/workflow/workflow.go Outdated
@britneywwc britneywwc requested a review from Copilot June 11, 2026 10:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 20 out of 20 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (1)

cmd/bauer/main.go:51

  • In --parse-only mode, --github-repo is allowed, but this code still attempts to fetch a GitHub token and can emit a misleading warning even though GitHub auth isn't required. Gate token retrieval on !parseOnly to match the advertised parse-only behavior.
	if *githubRepo != "" {
		var err error
		ghToken, err = github.GetGitHubToken()
		if err != nil {
			fmt.Fprintf(os.Stderr, "WARNING: Could not get GitHub token: %v\n", err)
		}
	}

Comment thread README.md
Comment thread internal/workflow/workflow.go Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 20 out of 20 changed files in this pull request and generated 4 comments.

Comment thread README.md
Comment on lines 24 to 27
./bauer --doc-id <doc-id> \
--credentials <path-to-creds> \
--parse-only
--credentials <path-to-creds>
--github-repo <github-repo>
```
Comment thread README.md
--credentials <path-to-creds>
--github-repo <github-repo>
```
Additionally, you can run it with `--parse-only` without creeting an issue.
Comment on lines +261 to +264
repoPromptDir := filepath.Base(filepath.Clean(input.OutputDir))
if repoPromptDir == "." {
repoPromptDir = ""
}
Comment thread README.md
Comment on lines 42 to +43
1. Build Bauer locally using the Local development steps above (`task build`)
2. If running with GitHub integration (no `--parse-only`), ensure `copilot` is installed and authenticated
2. If running with GitHub issue creation (no `--parse-only`), ensure GitHub CLI auth is available
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants