gitforge/modules/structs
ShellWen a85c527709 feat(api): add REST API endpoints for Actions artifacts (#12140)
## Checklist

The [contributor guide](https://forgejo.org/docs/next/contributor/) contains information that will be helpful to first time contributors. All work and communication must conform to Forgejo's [AI Agreement](https://codeberg.org/forgejo/governance/src/branch/main/AIAgreement.md). There also are a few [conditions for merging Pull Requests in Forgejo repositories](https://codeberg.org/forgejo/governance/src/branch/main/PullRequestsAgreement.md). You are also welcome to join the [Forgejo development chatroom](https://matrix.to/#/#forgejo-development:matrix.org).

### Tests for Go changes

- I added test coverage for Go changes...
  - [ ] in their respective `*_test.go` for unit tests.
  - [x] in the `tests/integration` directory if it involves interactions with a live Forgejo server.
- I ran...
  - [x] `make pr-go` before pushing

### Tests for JavaScript changes

(not applicable — Go-only change)

### Documentation

- [ ] I created a pull request [to the documentation](https://codeberg.org/forgejo/docs) to explain to Forgejo users how to use this change.
- [ ] I did not document these changes and I do not expect someone else to do it.

### Release notes

- [x] This change will be noticed by a Forgejo user or admin (feature, bug fix, performance, etc.). I suggest to include a release note for this change.
- [ ] This change is not visible to a Forgejo user or admin (refactor, dependency upgrade, etc.). I think there is no need to add a release note for this change.

## Summary

Add public REST API endpoints under `/api/v1/` for listing, inspecting, downloading, and deleting Actions artifacts. Previously, artifacts could only be accessed through the web UI or the internal runner API.

### New endpoints

| Method | Path | Description |
|--------|------|-------------|
| `GET` | `/repos/{owner}/{repo}/actions/artifacts` | List all artifacts for a repository |
| `GET` | `/repos/{owner}/{repo}/actions/runs/{run_id}/artifacts` | List artifacts for a workflow run |
| `GET` | `/repos/{owner}/{repo}/actions/artifacts/{artifact_id}` | Get artifact metadata |
| `GET` | `/repos/{owner}/{repo}/actions/artifacts/{artifact_id}/zip` | Download artifact as zip |
| `DELETE` | `/repos/{owner}/{repo}/actions/artifacts/{artifact_id}` | Delete an artifact |

- List endpoints support `page`, `limit`, and `name` query parameters
- Both v1-v3 (multi-file, zip on-the-fly) and v4 (single zip) artifact backends are supported
- Expired artifacts are listed with `expired: true` but cannot be downloaded
- Delete requires write permission; all other endpoints require read permission

Co-authored-by: Mathieu Fenniak <mathieu@fenniak.net>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/12140
Reviewed-by: Andreas Ahlenstorf <aahlenst@noreply.codeberg.org>
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.codeberg.org>
Co-authored-by: ShellWen <me@shellwen.com>
Co-committed-by: ShellWen <me@shellwen.com>
2026-04-20 05:10:54 +02:00
..
action.go feat(api): add REST API endpoints for Actions artifacts (#12140) 2026-04-20 05:10:54 +02:00
activity.go
activitypub.go Improved signature handling & instance actor (#8275) 2025-07-01 19:49:00 +02:00
admin_user.go feat: Add support for administrators to set email visibility on user accounts (#9668) 2025-10-15 03:21:15 +02:00
attachment.go fix(ui): Add pasted images to dropzone 2025-06-30 12:42:22 +02:00
commit_status.go docs: add back warning as a commit status (#8935) 2025-10-01 04:52:16 +02:00
commit_status_test.go
cron.go
doc.go
fork.go feat: sync forks (#2364) 2025-04-07 07:00:38 +00:00
git_blob.go api: GitBlob consistent naming 2025-06-13 11:35:14 +02:00
git_hook.go
hook.go Revert "fix(api): document is_system_webhook field (#7784)" (#8286) 2025-06-26 00:36:18 +02:00
issue.go chore: add modernizer linter (#11936) 2026-04-02 03:29:37 +02:00
issue_comment.go feat(api): more verbose error messages and swagger comments for posting issue comments (#11368) 2026-03-07 23:16:20 +01:00
issue_label.go
issue_milestone.go
issue_reaction.go
issue_stopwatch.go
issue_test.go chore: replace gopkg.in/yaml.v3 with go.yaml.in/yaml/v3 (#8956) 2025-08-20 15:31:12 +02:00
issue_tracked_time.go
lfs_lock.go
mirror.go feat: add configuration to only push mirror selected branches (#7823) 2025-07-12 00:39:35 +02:00
miscellaneous.go
moderation.go
nodeinfo.go
notifications.go
org.go Inclusion of rename organization api (#33303) 2025-02-02 12:01:58 +01:00
org_member.go
org_team.go fix: correct malformed CreateTeamOption example (#11093) 2026-02-16 05:55:20 +01:00
package.go
pull.go fix(migrations): transfer PR flow information (#7421) 2025-04-03 06:47:37 +00:00
pull_review.go Fix invalid swagger syntax of $ref with sibling (#7019) 2025-02-21 14:09:21 +00:00
quota.go
release.go
repo.go chore: add modernizer linter (#11936) 2026-04-02 03:29:37 +02:00
repo_actions.go feat: implement ephemeral runners (#9962) 2026-02-16 18:56:56 +01:00
repo_branch.go
repo_collaborator.go
repo_commit.go
repo_compare.go
repo_file.go feat(api): add last_commit_when to contents response (#7418) 2025-04-18 09:31:40 +00:00
repo_flags.go
repo_key.go
repo_note.go
repo_refs.go
repo_tag.go
repo_topic.go
repo_tree.go
repo_watch.go
repo_wiki.go
runner.go chore: remove field ephemeral from runner registration response (#11350) 2026-02-18 16:49:44 +01:00
secret.go fix: normalize secrets consistently, display accurate help (#11052) 2026-02-09 17:02:18 +01:00
settings.go
status.go
task.go
user.go chore: add modernizer linter (#11936) 2026-04-02 03:29:37 +02:00
user_app.go feat: read, create, & delete repo-specific access tokens via API (#11504) 2026-03-07 21:55:08 +01:00
user_email.go
user_gpgkey.go chore: add modernizer linter (#11936) 2026-04-02 03:29:37 +02:00
user_key.go chore: add modernizer linter (#11936) 2026-04-02 03:29:37 +02:00
variable.go fix: normalize secrets consistently, display accurate help (#11052) 2026-02-09 17:02:18 +01:00
visible_type.go
workflow.go feat(api): return run_number in workflow dispatch (#7286) 2025-03-25 21:22:32 +00:00