-
Notifications
You must be signed in to change notification settings - Fork 49
Include .agents folder in sparse checkout for agent jobs #13901
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
+74
−14
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
1af9fbf
Initial plan
Copilot 58bdd39
Add .agents folder to sparse-checkout alongside .github
Copilot 2b673e4
Fix formatting in test file
Copilot ce6aff4
Document that .agents folder is optional and handled gracefully
Copilot 9d6b778
Remove redundant documentation about sparse-checkout behavior
Copilot 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
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 |
|---|---|---|
|
|
@@ -145,9 +145,9 @@ func (c *Compiler) generateCheckoutActionsFolder(data *WorkflowData) []string { | |
| return nil | ||
| } | ||
|
|
||
| // generateCheckoutGitHubFolder generates the checkout step for the .github folder | ||
| // for the agent job. This ensures workflows have access to workflow configurations | ||
| // and runtime imports even when they don't do a full repository checkout. | ||
| // generateCheckoutGitHubFolder generates the checkout step for the .github and .agents folders | ||
| // for the agent job. This ensures workflows have access to workflow configurations, | ||
| // runtime imports, and skills even when they don't do a full repository checkout. | ||
| // | ||
| // This checkout works in all modes (dev, script, release) and uses shallow clone | ||
| // for minimal overhead. It should only be called in the main agent job. | ||
|
|
@@ -171,32 +171,33 @@ func (c *Compiler) generateCheckoutGitHubFolder(data *WorkflowData) []string { | |
| // Check if we have contents permission - without it, checkout is not possible | ||
| permParser := NewPermissionsParser(data.Permissions) | ||
| if !permParser.HasContentsReadAccess() { | ||
| compilerYamlLog.Print("Skipping .github checkout: no contents read access") | ||
| compilerYamlLog.Print("Skipping .github and .agents checkout: no contents read access") | ||
| return nil | ||
| } | ||
|
|
||
| // Skip .github checkout if custom steps already contain a full repository checkout | ||
| // The full checkout already includes the .github folder, making sparse checkout redundant | ||
| // Skip .github and .agents checkout if custom steps already contain a full repository checkout | ||
| // The full checkout already includes these folders, making sparse checkout redundant | ||
| if data.CustomSteps != "" && ContainsCheckout(data.CustomSteps) { | ||
| compilerYamlLog.Print("Skipping .github sparse checkout: custom steps contain full repository checkout") | ||
| compilerYamlLog.Print("Skipping .github and .agents sparse checkout: custom steps contain full repository checkout") | ||
| return nil | ||
| } | ||
|
|
||
| // Skip .github checkout if an automatic full repository checkout will be added | ||
| // Skip .github and .agents checkout if an automatic full repository checkout will be added | ||
| // The shouldAddCheckoutStep function returns true when a checkout step will be automatically added | ||
| if c.shouldAddCheckoutStep(data) { | ||
| compilerYamlLog.Print("Skipping .github sparse checkout: full repository checkout will be added automatically") | ||
| compilerYamlLog.Print("Skipping .github and .agents sparse checkout: full repository checkout will be added automatically") | ||
| return nil | ||
| } | ||
|
|
||
| // For all modes (dev, script, release), checkout .github folder | ||
| // For all modes (dev, script, release), checkout .github and .agents folders | ||
| // This works in release mode where actions aren't checked out | ||
| return []string{ | ||
| " - name: Checkout .github folder\n", | ||
| " - name: Checkout .github and .agents folders\n", | ||
| fmt.Sprintf(" uses: %s\n", GetActionPin("actions/checkout")), | ||
| " with:\n", | ||
| " sparse-checkout: |\n", | ||
| " .github\n", | ||
| " .agents\n", | ||
| " depth: 1\n", | ||
|
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. @copilot this is implied by sparse checkout
Contributor
Author
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. Removed the redundant note. Sparse-checkout behavior is indeed implied. (9d6b778) |
||
| " persist-credentials: false\n", | ||
| } | ||
|
|
||
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
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.
Inconsistent logger variable usage. This file defines and uses
compilerYamlHelpersLogat line 12, and all other functions in this file use that logger (see lines 31, 35, 49, 62). The log statements on lines 178, 185, and 192 should usecompilerYamlHelpersLoginstead ofcompilerYamlLogto be consistent with the rest of the file.This issue also appears in the following locations of the same file: