Skip to content

fix(storage): migrate GitHub artifact upload from deprecated v1-v3 API to v4#2612

Open
kiwamizamurai wants to merge 1 commit intodiggerhq:developfrom
kiwamizamurai:fix/github-artifacts-v4-upload
Open

fix(storage): migrate GitHub artifact upload from deprecated v1-v3 API to v4#2612
kiwamizamurai wants to merge 1 commit intodiggerhq:developfrom
kiwamizamurai:fix/github-artifacts-v4-upload

Conversation

@kiwamizamurai
Copy link

Summary

Fixes #1702

The old StorePlanFile implementation called _apis/pipelines/workflows/{runID}/artifacts?api-version=6.0-preview (via ACTIONS_RUNTIME_URL), which was the deprecated Artifacts v1-v3 internal API. GitHub has since removed this endpoint, causing HTTP 400 errors for anyone using upload-plan-destination: github.

This PR replaces the upload path with the Artifacts v4 Twirp/JSON protocol used by @actions/artifact v2+:

  1. POST {ACTIONS_RESULTS_URL}/twirp/github.actions.results.api.v1.ArtifactService/CreateArtifact → receive signed_upload_url
  2. PUT file contents to the signed Azure Blob URL (x-ms-blob-type: BlockBlob)
  3. POST .../FinalizeArtifact to commit the upload

The download path (DownloadLatestPlans, PlanExists, RetrievePlan) already uses the stable GitHub REST API (go-github client) and is unchanged.

Changes

  • libs/storage/plan_storage.go: Replace deprecated v1-v3 upload logic in StorePlanFile with v4 Twirp/JSON calls
  • Uses ACTIONS_RESULTS_URL + GITHUB_RUN_ATTEMPT (new env vars available in all GitHub Actions runners)

Test plan

  • Compilation verified (go build ./libs/storage/...)
  • No existing tests for GithubPlanStorage (env vars only available inside GitHub Actions runners); tested by running a workflow with upload-plan-destination: github

Note: The team mentioned v4 uses protobuf — Twirp supports both binary protobuf and JSON encoding. This implementation uses JSON, which avoids adding a protobuf dependency.

🤖 Generated with Claude Code

…I to v4

The old implementation used the internal `_apis/pipelines/workflows/{runID}/artifacts?api-version=6.0-preview`
endpoint (via ACTIONS_RUNTIME_URL), which GitHub deprecated and removed, causing HTTP 400 errors.

Replace with the Artifacts v4 Twirp/JSON protocol (ACTIONS_RESULTS_URL based):
1. POST CreateArtifact → receive signed_upload_url
2. PUT file contents to the signed Azure Blob URL
3. POST FinalizeArtifact to commit the upload

Closes diggerhq#1702

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@kiwamizamurai kiwamizamurai changed the base branch from main to develop March 15, 2026 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

upload-plan-destination: github is using deprecated Artifact API scheduled for EOL on November 30, 2024

1 participant