decap-cms-backend-forgejo 3.4.1 → 3.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/decap-cms-backend-forgejo.js +1 -1
- package/dist/decap-cms-backend-forgejo.js.map +1 -1
- package/dist/esm/API.js +8 -3
- package/package.json +4 -4
- package/src/API.ts +10 -3
- package/src/__tests__/API.spec.js +17 -0
package/dist/esm/API.js
CHANGED
|
@@ -402,14 +402,19 @@ export default class API {
|
|
|
402
402
|
}
|
|
403
403
|
return pullRequests.filter(pr => {
|
|
404
404
|
const label = pr.head?.label;
|
|
405
|
-
if (label) {
|
|
406
|
-
return label === head;
|
|
407
|
-
}
|
|
408
405
|
const repoOwner = pr.head?.repo?.owner?.login;
|
|
409
406
|
const ref = pr.head?.ref;
|
|
407
|
+
if (label === head) {
|
|
408
|
+
return true;
|
|
409
|
+
}
|
|
410
410
|
if (repoOwner && ref) {
|
|
411
411
|
return `${repoOwner}:${ref}` === head;
|
|
412
412
|
}
|
|
413
|
+
|
|
414
|
+
// Forgejo may return a branch-only label for same-repository PRs.
|
|
415
|
+
if (ref) {
|
|
416
|
+
return `${this.repoOwner}:${ref}` === head;
|
|
417
|
+
}
|
|
413
418
|
return false;
|
|
414
419
|
});
|
|
415
420
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "decap-cms-backend-forgejo",
|
|
3
3
|
"description": "Forgejo backend for Decap CMS",
|
|
4
|
-
"version": "3.4.
|
|
4
|
+
"version": "3.4.2",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/decaporg/decap-cms/tree/main/packages/decap-cms-backend-forgejo"
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
"lodash": "^4.17.11",
|
|
29
29
|
"prop-types": "^15.7.2",
|
|
30
30
|
"react": "^19.1.0",
|
|
31
|
-
"decap-cms-
|
|
32
|
-
"decap-cms-lib-
|
|
33
|
-
"decap-cms-
|
|
31
|
+
"decap-cms-lib-auth": "3.3.2",
|
|
32
|
+
"decap-cms-lib-util": "3.8.2",
|
|
33
|
+
"decap-cms-ui-default": "3.9.2"
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
36
36
|
"develop": "npm run build:esm -- --watch",
|
package/src/API.ts
CHANGED
|
@@ -587,14 +587,21 @@ export default class API {
|
|
|
587
587
|
|
|
588
588
|
return pullRequests.filter(pr => {
|
|
589
589
|
const label = pr.head?.label;
|
|
590
|
-
if (label) {
|
|
591
|
-
return label === head;
|
|
592
|
-
}
|
|
593
590
|
const repoOwner = pr.head?.repo?.owner?.login;
|
|
594
591
|
const ref = pr.head?.ref;
|
|
592
|
+
|
|
593
|
+
if (label === head) {
|
|
594
|
+
return true;
|
|
595
|
+
}
|
|
595
596
|
if (repoOwner && ref) {
|
|
596
597
|
return `${repoOwner}:${ref}` === head;
|
|
597
598
|
}
|
|
599
|
+
|
|
600
|
+
// Forgejo may return a branch-only label for same-repository PRs.
|
|
601
|
+
if (ref) {
|
|
602
|
+
return `${this.repoOwner}:${ref}` === head;
|
|
603
|
+
}
|
|
604
|
+
|
|
598
605
|
return false;
|
|
599
606
|
});
|
|
600
607
|
}
|
|
@@ -688,6 +688,23 @@ describe('forgejo API', () => {
|
|
|
688
688
|
});
|
|
689
689
|
});
|
|
690
690
|
|
|
691
|
+
it('should match pull request by ref when head label does not include the owner', async () => {
|
|
692
|
+
const api = new API({ branch: 'gh-pages', repo: 'owner/my-repo', token: 'token' });
|
|
693
|
+
api.requestAllPages = jest.fn().mockResolvedValue([
|
|
694
|
+
{
|
|
695
|
+
number: 1,
|
|
696
|
+
head: { label: 'cms/new-branch', ref: 'cms/new-branch' },
|
|
697
|
+
},
|
|
698
|
+
]);
|
|
699
|
+
|
|
700
|
+
await expect(api.getPullRequests('open', 'owner:cms/new-branch')).resolves.toEqual([
|
|
701
|
+
{
|
|
702
|
+
number: 1,
|
|
703
|
+
head: { label: 'cms/new-branch', ref: 'cms/new-branch' },
|
|
704
|
+
},
|
|
705
|
+
]);
|
|
706
|
+
});
|
|
707
|
+
|
|
691
708
|
it('should list unpublished branches (standard mode)', async () => {
|
|
692
709
|
const api = new API({
|
|
693
710
|
branch: 'gh-pages',
|