Add vcs remote type (#162)
ci/woodpecker/tag/docker Pipeline was successful

The generic `github` remote only allowlists URL patterns: every repo needs hand-written mutable patterns for branch archives, and a moved branch re-downloads the whole archive under a ref-named key.

- add `vcs` package type for GitHub or Gitea (picked from `base_url`) tag, commit and release-download paths, cached immutable
- redirect `archive/refs/heads/<branch>` to the commit archive, resolving the branch via the branch API with one shared, per-remote bounded lookup cache reused for `mutable_ttl`
- cache missing branches for at least 60s and map API rate limits to `503` with `Retry-After`
- reject any other path shape, escaping segments and denied redirect targets
- add `docs/vcs/remote.md`, a UI type def and a vcs e2e caching case

Reviewed-on: #162
Co-authored-by: unkin-agent <unkin-agent@unkin.net>
Co-committed-by: unkin-agent <unkin-agent@unkin.net>
This commit was merged in pull request #162.
This commit is contained in:
2026-10-24 17:21:05 +11:00
committed by BenVincent
parent 7fa5434dbc
commit 2905ec99e4
11 changed files with 762 additions and 4 deletions
+26
View File
@@ -0,0 +1,26 @@
import type { PackageTypeUI } from '../types';
const def: PackageTypeUI = {
color: 'default',
snippets: ({ proxy }) => {
return [
{
title: 'Download a tag archive',
language: 'bash',
code: `curl -fsSLO ${proxy}/<owner>/<repo>/archive/refs/tags/<tag>.tar.gz`,
},
{
title: 'Download a branch archive (redirects to its current commit)',
language: 'bash',
code: `curl -fsSL -o src.tar.gz ${proxy}/<owner>/<repo>/archive/refs/heads/<branch>.tar.gz`,
},
{
title: 'Download a release asset',
language: 'bash',
code: `curl -fsSLO ${proxy}/<owner>/<repo>/releases/download/<tag>/<asset>`,
},
];
},
};
export default def;