-
Notifications
You must be signed in to change notification settings - Fork 267
Fix missing cross-repo and auth properties in safe output schemas #18754
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
768932f
Initial plan
Copilot d33ab04
Initial plan for safe outputs schema fixes
Copilot e43e579
Fix safe outputs missing target-repo, allowed-repos, and github-token…
Copilot 223cf96
Wire github-token and cross-repo fields through handler config and st…
Copilot 8d7380e
Address code review: add comments for firstNonEmpty and token precede…
Copilot bbc11a3
cleanup project token
dsyme 97a4707
Add handler_auth.cjs shared helper and consistent cross-repo/auth acr…
Copilot a595dbb
Merge branch 'main' into copilot/fix-safe-outputs-target-repo-support
dsyme c48945d
feat: extend createAuthenticatedGitHubClient to all remaining safe-ou…
Copilot dbfd7b0
Merge branch 'main' into copilot/fix-safe-outputs-target-repo-support
dsyme aae9308
Fix review comments: inaccurate comments, doc string, and handler_aut…
Copilot 5a9cf76
Merge branch 'main' into copilot/fix-safe-outputs-target-repo-support
pelikhan 2adf303
Merge branch 'main' into copilot/fix-safe-outputs-target-repo-support
pelikhan 5128e5e
Add changeset [skip-ci]
3742d7a
ci: trigger CI checks
github-actions[bot] f5bc83b
Fix CI test failures: update aw_info_versions_test.go to use GH_AW_IN…
Copilot 76411ab
test: Add smoke test file for Claude engine validation (run 22526414043)
claude 724115a
ci: trigger CI checks
github-actions[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| # Smoke Test File | ||
|
|
||
| Created by smoke test run 22526414043 for Claude engine validation. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,6 +13,7 @@ const { getErrorMessage } = require("./error_helpers.cjs"); | |
| const { parseBoolTemplatable } = require("./templatable.cjs"); | ||
| const { resolveTarget } = require("./safe_output_helpers.cjs"); | ||
| const { resolveTargetRepoConfig, resolveAndValidateRepo } = require("./repo_helpers.cjs"); | ||
| const { createAuthenticatedGitHubClient } = require("./handler_auth.cjs"); | ||
| const { getMissingInfoSections } = require("./missing_messages_helper.cjs"); | ||
| const { getMessages } = require("./messages_core.cjs"); | ||
| const { sanitizeContent } = require("./sanitize_content.cjs"); | ||
|
|
@@ -302,6 +303,10 @@ async function main(config = {}) { | |
| const maxCount = config.max || 20; | ||
| const { defaultTargetRepo, allowedRepos } = resolveTargetRepoConfig(config); | ||
|
|
||
| // Create an authenticated GitHub client. Uses config["github-token"] when set | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Creating |
||
| // (for cross-repository operations), otherwise falls back to the step-level github. | ||
| const authClient = await createAuthenticatedGitHubClient(config); | ||
|
|
||
| // Check if we're in staged mode | ||
| const isStaged = process.env.GH_AW_SAFE_OUTPUTS_STAGED === "true"; | ||
|
|
||
|
|
@@ -453,7 +458,7 @@ async function main(config = {}) { | |
| if (item.item_number !== undefined && item.item_number !== null) { | ||
| // Explicit item_number: fetch the issue/PR to get its author | ||
| try { | ||
| const { data: issueData } = await github.rest.issues.get({ | ||
| const { data: issueData } = await authClient.rest.issues.get({ | ||
| owner: repoParts.owner, | ||
| repo: repoParts.repo, | ||
| issue_number: itemNumber, | ||
|
|
@@ -556,7 +561,7 @@ async function main(config = {}) { | |
| // Hide older comments if enabled AND append-only-comments is not enabled | ||
| // When append-only-comments is true, we want to keep all comments visible | ||
| if (hideOlderCommentsEnabled && !appendOnlyComments && workflowId) { | ||
| await hideOlderComments(github, repoParts.owner, repoParts.repo, itemNumber, workflowId, isDiscussion); | ||
| await hideOlderComments(authClient, repoParts.owner, repoParts.repo, itemNumber, workflowId, isDiscussion); | ||
| } else if (hideOlderCommentsEnabled && appendOnlyComments) { | ||
| core.info("Skipping hide-older-comments because append-only-comments is enabled"); | ||
| } | ||
|
|
@@ -574,7 +579,7 @@ async function main(config = {}) { | |
| } | ||
| } | ||
| `; | ||
| const queryResult = await github.graphql(discussionQuery, { | ||
| const queryResult = await authClient.graphql(discussionQuery, { | ||
| owner: repoParts.owner, | ||
| repo: repoParts.repo, | ||
| number: itemNumber, | ||
|
|
@@ -585,10 +590,10 @@ async function main(config = {}) { | |
| throw new Error(`${ERR_NOT_FOUND}: Discussion #${itemNumber} not found in ${itemRepo}`); | ||
| } | ||
|
|
||
| comment = await commentOnDiscussion(github, repoParts.owner, repoParts.repo, itemNumber, processedBody, null); | ||
| comment = await commentOnDiscussion(authClient, repoParts.owner, repoParts.repo, itemNumber, processedBody, null); | ||
| } else { | ||
| // Use REST API for issues/PRs | ||
| const { data } = await github.rest.issues.createComment({ | ||
| const { data } = await authClient.rest.issues.createComment({ | ||
| owner: repoParts.owner, | ||
| repo: repoParts.repo, | ||
| issue_number: itemNumber, | ||
|
|
@@ -644,7 +649,7 @@ async function main(config = {}) { | |
| } | ||
| } | ||
| `; | ||
| const queryResult = await github.graphql(discussionQuery, { | ||
| const queryResult = await authClient.graphql(discussionQuery, { | ||
| owner: repoParts.owner, | ||
| repo: repoParts.repo, | ||
| number: itemNumber, | ||
|
|
@@ -656,7 +661,7 @@ async function main(config = {}) { | |
| } | ||
|
|
||
| core.info(`Found discussion #${itemNumber}, adding comment...`); | ||
| const comment = await commentOnDiscussion(github, repoParts.owner, repoParts.repo, itemNumber, processedBody, null); | ||
| const comment = await commentOnDiscussion(authClient, repoParts.owner, repoParts.repo, itemNumber, processedBody, null); | ||
|
|
||
| core.info(`Created comment on discussion: ${comment.html_url}`); | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good pattern — importing
createAuthenticatedGitHubClienthere ensures all GitHub API calls in this file use the correct token for cross-repo operations.