-
Couldn't load subscription status.
- Fork 325
Make Release EA Process per-adapter #4133
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
base: main
Are you sure you want to change the base?
Conversation
|
| name: Determine Release Mode | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| release-mode: ${{ steps.determine.outputs.release-mode }} | ||
| adapter-list: ${{ steps.determine.outputs.adapter-list }} | ||
| steps: | ||
| - uses: actions/checkout@v5 | ||
| with: | ||
| persist-credentials: false | ||
| fetch-depth: 2 | ||
|
|
||
| - name: Determine release mode | ||
| id: determine | ||
| env: | ||
| EVENT_NAME: ${{ github.event_name }} | ||
| ADAPTERS_INPUT: ${{ inputs.adapters }} | ||
| BUILD_ALL: ${{ inputs.build-all }} | ||
| run: | | ||
| if [ "$EVENT_NAME" = "workflow_dispatch" ] && [ -n "$ADAPTERS_INPUT" ]; then | ||
| echo "release-mode=selective" >> $GITHUB_OUTPUT | ||
| echo "Using selective release mode for: $ADAPTERS_INPUT" | ||
| else | ||
| echo "release-mode=legacy" >> $GITHUB_OUTPUT | ||
| echo "Using legacy release mode (MASTERLIST.md trigger or build-all)" | ||
| fi | ||
| # Selective release: Parse adapters from RELEASES.yaml | ||
| parse-selective-adapters: |
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 7 days ago
The recommended fix is to add a permissions: key with the minimum necessary privileges. Typically, for release workflows that read contents but do not need to push code, at minimum you'll need contents: read. This can be set at the top of the workflow to apply to all jobs (the normal approach unless a job needs more/less permissions), or at the job level for the jobs that need custom permissions. Since there is no evidence in the provided snippet that any step requires write permissions, we'll set contents: read only (which will be secure). Add the following at the root of the workflow, just after the name: (e.g., line 2). No imports, package changes, or additional steps are needed; this is a YAML metadata change.
-
Copy modified lines R2-R3
| @@ -1,4 +1,6 @@ | ||
| name: Release | ||
| permissions: | ||
| contents: read | ||
|
|
||
| on: | ||
| push: |
| name: Compute changed adapters (Legacy) | ||
| needs: determine-release-mode | ||
| if: needs.determine-release-mode.outputs.release-mode == 'legacy' | ||
| runs-on: [ubuntu-latest] | ||
| env: | ||
| BUILD_ALL: ${{ inputs.build-all }} | ||
| outputs: | ||
| adapter-list: ${{ steps.changed-adapters.outputs.CHANGED_ADAPTERS }} | ||
| steps: | ||
| - uses: actions/checkout@v5 | ||
| with: | ||
| persist-credentials: false | ||
| fetch-depth: 2 | ||
| - name: Set up and install dependencies | ||
| uses: ./.github/actions/setup | ||
| with: | ||
| skip-setup: true | ||
| - name: Build list of changed packages and changed adapters | ||
| id: changed-adapters | ||
| env: | ||
| UPSTREAM_BRANCH: HEAD~1 | ||
| run: | | ||
| ./.github/scripts/changed-adapters.sh | ||
| # Merge adapter lists from both modes | ||
| merge-adapter-lists: | ||
| name: Merge Adapter Lists | ||
| needs: [determine-release-mode, parse-selective-adapters, calculate-changes] | ||
| if: always() && !cancelled() | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| adapter-list: ${{ steps.merge.outputs.adapter-list }} | ||
| release-mode: ${{ needs.determine-release-mode.outputs.release-mode }} | ||
| steps: | ||
| - name: Merge lists | ||
| id: merge | ||
| env: | ||
| RELEASE_MODE: ${{ needs.determine-release-mode.outputs.release-mode }} | ||
| SELECTIVE_LIST: ${{ needs.parse-selective-adapters.outputs.adapter-list }} | ||
| LEGACY_LIST: ${{ needs.calculate-changes.outputs.adapter-list }} |
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 7 days ago
To resolve the issue, we need to explicitly declare a minimal permissions block for the calculate-changes job in .github/workflows/release.yml. The recommended least-privilege setting is typically contents: read, unless the job requires additional (write) permissions for specific tasks. In this job, it does not appear to need anything beyond read access to repository contents.
Specifically, add this block just under calculate-changes: (i.e., under line 206):
permissions:
contents: readNo imports or other changes are required. This change is contained entirely to the .github/workflows/release.yml file and does not affect any other job or workflow functionality.
-
Copy modified lines R208-R209
| @@ -205,6 +205,8 @@ | ||
| # Legacy release: Use changed-adapters.sh | ||
| calculate-changes: | ||
| name: Compute changed adapters (Legacy) | ||
| permissions: | ||
| contents: read | ||
| needs: determine-release-mode | ||
| if: needs.determine-release-mode.outputs.release-mode == 'legacy' | ||
| runs-on: [ubuntu-latest] |
Enable Per-Adapter EA Releases
Problem
EA releases are all-or-none. If one adapter is ready, ALL changed adapters must be released together.
Solution
Enable releasing adapters individually or all together (your choice).
What Changed
1.
deploy.yml(1 line added)Line 166: Enable per-adapter PRs in infra-k8s
-F per-adapter-prs=true2.
release.yml(Complete rewrite)Selective releases with security validation:
gh workflow run release.yml)gh workflow run release.yml -f adapters=coingecko)3.
upsert-release-pr.yml(1 step added)Auto-populates RELEASES.yaml:
4.
RELEASES.yaml(NEW - 135 lines)Central tracking file:
Has comprehensive inline docs (all instructions in the file itself).
5.
scripts/release-manager.sh(NEW - 345 lines)CLI tool (mostly automated, rarely needed):
./scripts/release-manager.sh list # Check what's pending ./scripts/release-manager.sh status coingeckoHow It Works Together
Full Flow
upsert-release-pr.ymlcreates Release PRRELEASES.yaml(tested_in_infra: false)deploy.ymltriggers infra-k8s withper-adapter-prs=trueimages/ea/<adapter>)gh workflow run release.yml(or merge Release PR for auto-release)release.ymlvalidates and publishesKey Points
Security Validation
Every release checks:
NOT TESTED - Hasn't run in GitHub Actions or been verified with real data.
Before Production
yamllint .github/workflows/*.ymlgh workflow run release.yml -f dry-run=trueRollback
Change line 166 in
deploy.yml:-F per-adapter-prs=falseFiles Modified
.github/workflows/deploy.yml(1 line).github/workflows/release.yml(rewritten).github/workflows/upsert-release-pr.yml(+1 step, note about webhook)RELEASES.yaml(NEW)scripts/release-manager.sh(NEW, needschmod +x)Requires: Companion PR in
infra-k8s(merge both together)Infrastructure: Uses existing GitHub token from infra-k8s (no new setup needed)