decap-cms-backend-forgejo 3.4.0 → 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/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,8 +1,11 @@
1
1
  {
2
2
  "name": "decap-cms-backend-forgejo",
3
3
  "description": "Forgejo backend for Decap CMS",
4
- "version": "3.4.0",
5
- "repository": "https://github.com/decaporg/decap-cms/tree/main/packages/decap-cms-backend-forgejo",
4
+ "version": "3.4.2",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/decaporg/decap-cms/tree/main/packages/decap-cms-backend-forgejo"
8
+ },
6
9
  "bugs": "https://github.com/decaporg/decap-cms/issues",
7
10
  "license": "MIT",
8
11
  "module": "dist/esm/index.js",
@@ -13,11 +16,6 @@
13
16
  "forgejo"
14
17
  ],
15
18
  "sideEffects": false,
16
- "scripts": {
17
- "develop": "npm run build:esm -- --watch",
18
- "build": "cross-env NODE_ENV=production webpack",
19
- "build:esm": "cross-env NODE_ENV=esm babel src --out-dir dist/esm --ignore \"**/__tests__\" --root-mode upward --extensions \".js,.jsx,.ts,.tsx\""
20
- },
21
19
  "dependencies": {
22
20
  "common-tags": "^1.8.0",
23
21
  "js-base64": "^3.0.0",
@@ -26,13 +24,17 @@
26
24
  "peerDependencies": {
27
25
  "@emotion/react": "^11.11.1",
28
26
  "@emotion/styled": "^11.11.0",
29
- "decap-cms-lib-auth": "^3.0.0",
30
- "decap-cms-lib-util": "^3.0.0",
31
- "decap-cms-ui-default": "^3.0.0",
32
- "immutable": "^3.7.6",
27
+ "immutable": "^4.3.9",
33
28
  "lodash": "^4.17.11",
34
29
  "prop-types": "^15.7.2",
35
- "react": "^19.1.0"
30
+ "react": "^19.1.0",
31
+ "decap-cms-lib-auth": "3.3.2",
32
+ "decap-cms-lib-util": "3.8.2",
33
+ "decap-cms-ui-default": "3.9.2"
36
34
  },
37
- "gitHead": "ffe5ab7e61f4e7cb374a413bf9fe55f088d20ba2"
38
- }
35
+ "scripts": {
36
+ "develop": "npm run build:esm -- --watch",
37
+ "build": "cross-env NODE_ENV=production webpack",
38
+ "build:esm": "cross-env NODE_ENV=esm babel src --out-dir dist/esm --ignore \"**/__tests__\" --root-mode upward --extensions \".js,.jsx,.ts,.tsx\""
39
+ }
40
+ }
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',
package/LICENSE DELETED
@@ -1,22 +0,0 @@
1
- Copyright (c) 2016 Netlify <decap@p-m.si>
2
-
3
- MIT License
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining
6
- a copy of this software and associated documentation files (the
7
- "Software"), to deal in the Software without restriction, including
8
- without limitation the rights to use, copy, modify, merge, publish,
9
- distribute, sublicense, and/or sell copies of the Software, and to
10
- permit persons to whom the Software is furnished to do so, subject to
11
- the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be
14
- included in all copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.