Add GITHUB_AW_OUTPUT artifact upload with non-empty file validation and logs command awareness#127
Add GITHUB_AW_OUTPUT artifact upload with non-empty file validation and logs command awareness#127
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
pkg/workflow/compiler.go
Outdated
| 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.
@copilot add a check for a non-empty output file if possible
There was a problem hiding this comment.
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_OUTPUTfile as a workflow artifact namedaw_output.txtin 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
generateOutputCollectionStepfunction inpkg/workflow/compiler.goto add an artifact upload step that:actions/upload-artifact@v4to upload the output fileaw_output.txtfor 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: warnto 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.txtfiles with human-readable file size information.txtextensionformatFileSizehelper function for consistent file size formattingChanges
generateOutputCollectionStepfunction with non-empty content validationaw_output.txtartifactTesting
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.