-
Notifications
You must be signed in to change notification settings - Fork 4
Add GITHUB_AW_OUTPUT artifact upload with non-empty file validation and logs command awareness #127
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
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
pkg/workflow/compiler.go
Outdated
@@ -2322,6 +2322,13 @@ func (c *Compiler) generateOutputCollectionStep(yaml *strings.Builder, data *Wor | |||
yaml.WriteString(" echo '``````markdown' >> $GITHUB_STEP_SUMMARY\n") | |||
yaml.WriteString(" cat ${{ env.GITHUB_AW_OUTPUT }} >> $GITHUB_STEP_SUMMARY\n") | |||
yaml.WriteString(" echo '``````' >> $GITHUB_STEP_SUMMARY\n") | |||
yaml.WriteString(" - name: Upload agentic output file\n") | |||
yaml.WriteString(" if: always()\n") |
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.
@copilot add a check for a non-empty output file if possible
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.
Added a check for non-empty output file. The upload step now uses if: always() && steps.collect_output.outputs.output != ''
which only uploads the artifact when the collection step found non-empty content. This reuses the existing validation logic that checks for file existence and empty content. See commit c01a83d.
- Modified upload step condition from `if: always()` to `if: always() && steps.collect_output.outputs.output != ''` - Only uploads artifact when the collection step found non-empty content - Updated test to verify the new condition is present - Recompiled all existing workflow lock files with the new condition Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
@copilot make sure the logs command is aware of this new artifact file. |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
The logs command is now aware of the new
See commit 9930c9d. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
This PR implements automatic upload of the
GITHUB_AW_OUTPUT
file as a workflow artifact namedaw_output.txt
in all generated agentic workflows, with validation to only upload when the output file contains non-empty content. Additionally, the logs command is now aware of and can properly handle this new artifact.Problem
Previously, the agentic output file (
GITHUB_AW_OUTPUT
) was created during workflow execution and its contents were set as a workflow output, but the file itself was not persisted as an artifact. This made it difficult to:Additionally, there was no validation to prevent uploading empty or non-existent output files as artifacts, and the logs command was not aware of this new artifact type.
Solution
Artifact Upload Implementation
Modified the
generateOutputCollectionStep
function inpkg/workflow/compiler.go
to add an artifact upload step that:actions/upload-artifact@v4
to upload the output fileaw_output.txt
for consistent identificationif: always() && steps.collect_output.outputs.output != ''
to ensure upload happens even if previous steps fail, but only when the collection step found non-empty contentif-no-files-found: warn
to handle edge cases where the output file doesn't exist${{ env.GITHUB_AW_OUTPUT }}
Logs Command Awareness
Enhanced the logs command to be fully aware of the new artifact:
aw_output.txt
files with human-readable file size information.txt
extensionformatFileSize
helper function for consistent file size formattingChanges
generateOutputCollectionStep
function with non-empty content validationaw_output.txt
artifactTesting
Fixes #126.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.