feat: UI for the pull request trust management panel

See the documentation pull request for a description

https://codeberg.org/forgejo/docs/pulls/1567
https://forgejo.codeberg.page/@docs_pull_1567/docs/next/user/actions/security-pull-request/
This commit is contained in:
Earl Warren 2025-10-30 16:16:59 +01:00
commit 57f986c7b1
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00
10 changed files with 559 additions and 2 deletions

View file

@ -397,6 +397,44 @@ test('historical attempt dropdown interactions', async () => {
expect(window.location.href).toEqual(toAbsoluteUrl('/user1/repo2/actions/runs/123/jobs/1/attempt/2'));
});
test('run approval interaction', async () => {
const pullRequestLink = '/example-org/example-repo/pulls/456';
const wrapper = mount(RepoActionView, {
props: {
...defaultTestProps,
initialJobData: {
state: {
run: {
canApprove: true,
status: 'waiting',
commit: {
pusher: {},
branch: {
link: toAbsoluteUrl(pullRequestLink),
},
},
},
currentJob: {
steps: [
{
summary: 'Test Job',
},
],
},
},
logs: {
stepsLog: [],
},
},
},
});
await flushPromises();
const approve = wrapper.findAll('button').filter((button) => button.text() === 'Locale Approve');
expect(approve.length).toEqual(1);
approve[0].trigger('click');
expect(window.location.href).toEqual(toAbsoluteUrl(`${pullRequestLink}#pull-request-trust-panel`));
});
test('artifacts download links', async () => {
Object.defineProperty(document.documentElement, 'lang', {value: 'en'});
vi.spyOn(global, 'fetch').mockImplementation((url, opts) => {