Download only relevant project dependencies#2221
Download only relevant project dependencies#2221spetersenms wants to merge 5 commits intomicrosoft:mainfrom
Conversation
…from upstream projects
# Conflicts: # Actions/DownloadProjectDependencies/DownloadProjectDependencies.psm1 # Tests/DownloadProjectDependencies.Test.ps1
There was a problem hiding this comment.
Pull request overview
Optimizes the DownloadProjectDependencies GitHub Action to download only artifacts produced by a project’s dependency projects (instead of downloading all artifacts from the upstream matrix), reducing bandwidth and speeding up dependency resolution in large multi-project AL-Go repositories.
Changes:
- Add a new helper (
Get-DependencyArtifactPattern) to compute anactions/download-artifactminimatch pattern for dependency projects. - Update the composite action to compute and use the artifact download pattern before running the dependency resolution script.
- Add Pester coverage for the new pattern logic and document the behavior in README + release notes.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| Tests/DownloadProjectDependencies.Test.ps1 | Adds unit tests for dependency artifact pattern generation (branch/project sanitization, multiple dependencies, empty/missing maps). |
| Actions/DownloadProjectDependencies/action.yaml | Computes a dependency-only artifact pattern and uses it with actions/download-artifact to avoid downloading unrelated artifacts. |
| Actions/DownloadProjectDependencies/DownloadProjectDependencies.psm1 | Introduces and exports Get-DependencyArtifactPattern used by the composite action. |
| Actions/DownloadProjectDependencies/README.md | Documents that only dependency-project artifacts are downloaded (pattern-filtered). |
| RELEASENOTES.md | Notes the optimized dependency artifact download behavior. |
| _project: ${{ inputs.project }} | ||
| _projectDependenciesJson: ${{ inputs.projectDependenciesJson }} | ||
| run: | | ||
| . (Join-Path ${{ github.action_path }} "../AL-Go-Helper.ps1" -Resolve) |
There was a problem hiding this comment.
Suggestion: place this script in a file of its own.
There was a problem hiding this comment.
Script is in it's own file now, though still in the same action. We might want to consider if it should be moved to a separate action though to stay consistent with other AL-Go functionaltiy.
| Write-Host "No dependency projects found, skipping artifact download" | ||
| Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "hasPattern=false" | ||
| } | ||
| ${{ github.action_path }}/ComputeDependencyArtifactPattern.ps1 |
There was a problem hiding this comment.
Consider wrapping in Invoke-AlGoAction
Currently, when an AL-Go project depends on another AL-Go project, all artifacts from an upstream matrix is downloaded, even if a given project only depends on a subset of the projects in the upstream matrix. For smaller repos with few projects this is not much of an issue, but on larger repos with many projects, this can result in a lot of waster resources spent on downloading things that are not needed.
This features updates the download logic to use glob patterns in the download artifact action, to only download relevant artifacts. This is based on the dependency json we calculate earlier.
✅ Checklist