Repository: gitify-app/gitify
Pull request #779 (2024-02-16 10:32:46)

chore: bump pnpm/action-setup


Patch:
diff --git a/.github/workflows/build-app.yml b/.github/workflows/build-app.yml
index e5f3b1ff..7a1c0097 100644
--- a/.github/workflows/build-app.yml
+++ b/.github/workflows/build-app.yml
@@ -16,7 +16,7 @@ jobs:
 
     steps:
       - uses: actions/checkout@v4
-      - uses: pnpm/action-setup@v2
+      - uses: pnpm/action-setup@v3
       - uses: actions/setup-node@v4
         with:
           node-version-file: '.nvmrc'
@@ -41,7 +41,7 @@ jobs:
 
     steps:
       - uses: actions/checkout@v4
-      - uses: pnpm/action-setup@v2
+      - uses: pnpm/action-setup@v3
       - uses: actions/setup-node@v4
         with:
           node-version-file: '.nvmrc'
@@ -63,7 +63,7 @@ jobs:
 
     steps:
       - uses: actions/checkout@v4
-      - uses: pnpm/action-setup@v2
+      - uses: pnpm/action-setup@v3
       - uses: actions/setup-node@v4
         with:
           node-version-file: '.nvmrc'
diff --git a/.github/workflows/on-tag.yml b/.github/workflows/on-tag.yml
index bb450815..456a8972 100644
--- a/.github/workflows/on-tag.yml
+++ b/.github/workflows/on-tag.yml
@@ -24,7 +24,7 @@ jobs:
         with:
           repository: gitify-app/website
           token: ${{ secrets.GH_TOKEN }}
-      - uses: pnpm/action-setup@v2
+      - uses: pnpm/action-setup@v3
       - uses: actions/setup-node@v4
         with:
           node-version-file: '.nvmrc'
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index e239f90b..98284a76 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -12,7 +12,7 @@ jobs:
 
     steps:
       - uses: actions/checkout@v4
-      - uses: pnpm/action-setup@v2
+      - uses: pnpm/action-setup@v3
       - uses: actions/setup-node@v4
         with:
           node-version-file: '.nvmrc'
@@ -38,7 +38,7 @@ jobs:
 
     steps:
       - uses: actions/checkout@v4
-      - uses: pnpm/action-setup@v2
+      - uses: pnpm/action-setup@v3
       - uses: actions/setup-node@v4
         with:
           node-version-file: '.nvmrc'
@@ -58,7 +58,7 @@ jobs:
 
     steps:
       - uses: actions/checkout@v4
-      - uses: pnpm/action-setup@v2
+      - uses: pnpm/action-setup@v3
       - uses: actions/setup-node@v4
         with:
           node-version-file: '.nvmrc'
diff --git a/.github/workflows/validator.yml b/.github/workflows/validator.yml
index f816b77d..5490874b 100644
--- a/.github/workflows/validator.yml
+++ b/.github/workflows/validator.yml
@@ -38,7 +38,7 @@ jobs:
       - uses: actions/setup-node@v4
         with:
           node-version-file: .nvmrc
-      - uses: pnpm/action-setup@v2
+      - uses: pnpm/action-setup@v3
         with:
           run_install: false
       - run: pnpm install --global renovate
diff --git a/package.json b/package.json
index 2afc4458..959c0009 100644
--- a/package.json
+++ b/package.json
@@ -42,6 +42,10 @@
     {
       "name": "Jake 'Sid' Smith",
       "url": "https://github.com/JakeSidSmith"
+    },
+    {
+      "name": "Adam Setch",
+      "url": "https://github.com/setchy"
     }
   ],
   "license": "MIT",
diff --git a/src/components/Repository.tsx b/src/components/Repository.tsx
index 27e72085..3cdb5820 100644
--- a/src/components/Repository.tsx
+++ b/src/components/Repository.tsx
@@ -1,5 +1,3 @@
-const { shell } = require('electron');
-
 import React, { useCallback, useContext } from 'react';
 import { ReadIcon } from '@primer/octicons-react';
 import { CSSTransition, TransitionGroup } from 'react-transition-group';
@@ -7,6 +5,7 @@ import { CSSTransition, TransitionGroup } from 'react-transition-group';
 import { AppContext } from '../context/App';
 import { Notification } from '../typesGithub';
 import { NotificationRow } from './NotificationRow';
+import { openExternalLink } from '../utils/comms';
 
 interface IProps {
   hostname: string;
@@ -23,7 +22,7 @@ export const RepositoryNotifications: React.FC<IProps> = ({
 
   const openBrowser = useCallback(() => {
     const url = repoNotifications[0].repository.html_url;
-    shell.openExternal(url);
+    openExternalLink(url);
   }, [repoNotifications]);
 
   const markRepoAsRead = useCallback(() => {
diff --git a/src/components/Sidebar.tsx b/src/components/Sidebar.tsx
index 87b67326..38574a81 100644
--- a/src/components/Sidebar.tsx
+++ b/src/components/Sidebar.tsx
@@ -1,5 +1,5 @@
 import { BellIcon } from '@primer/octicons-react';
-import { ipcRenderer, shell } from 'electron';
+import { ipcRenderer } from 'electron';
 import React, { useCallback, useContext, useMemo } from 'react';
 import { useNavigate, useLocation } from 'react-router-dom';
 
@@ -9,6 +9,7 @@ import { IconCog } from '../icons/Cog';
 import { IconQuit } from '../icons/Quit';
 import { IconRefresh } from '../icons/Refresh';
 import { Constants } from '../utils/constants';
+import { openExternalLink } from '../utils/comms';
 
 export const Sidebar: React.FC = () => {
   const navigate = useNavigate();
@@ -18,11 +19,11 @@ export const Sidebar: React.FC = () => {
   const { notifications, fetchNotifications } = useContext(AppContext);
 
   const onOpenBrowser = useCallback(() => {
-    shell.openExternal(`https://github.com/${Constants.REPO_SLUG}`);
+    openExternalLink(`https://github.com/${Constants.REPO_SLUG}`);
   }, []);
 
   const onOpenGitHubNotifications = useCallback(() => {
-    shell.openExternal(`https://github.com/notifications`);
+    openExternalLink(`https://github.com/notifications`);
   }, []);
 
   const quitApp = useCallback(() => {
diff --git a/src/routes/LoginWithToken.tsx b/src/routes/LoginWithToken.tsx
index 32b3660f..d14285bb 100644
--- a/src/routes/LoginWithToken.tsx
+++ b/src/routes/LoginWithToken.tsx
@@ -2,12 +2,12 @@ import React, { useCallback, useContext, useState } from 'react';
 import { Form, FormRenderProps } from 'react-final-form';
 import { ArrowLeftIcon } from '@primer/octicons-react';
 import { useNavigate } from 'react-router-dom';
-import { shell } from 'electron';
 
 import { AppContext } from '../context/App';
 import { AuthTokenOptions } from '../types';
 import { Constants } from '../utils/constants';
 import { FieldInput } from '../components/fields/FieldInput';
+import { openExternalLink } from '../utils/comms';
 
 interface IValues {
   token?: string;
@@ -46,7 +46,7 @@ export const LoginWithToken: React.FC = () => {
   const [isValidToken, setIsValidToken] = useState<boolean>(true);
 
   const openLink = useCallback((url: string) => {
-    shell.openExternal(url);
+    openExternalLink(url);
   }, []);
 
   const renderForm = (formProps: FormRenderProps) => {
diff --git a/src/utils/comms.ts b/src/utils/comms.ts
index 09fe3a30..03beca86 100644
--- a/src/utils/comms.ts
+++ b/src/utils/comms.ts
@@ -1,7 +1,9 @@
 import { ipcRenderer, shell } from 'electron';
 
 export function openExternalLink(url: string): void {
-  shell.openExternal(url);
+  if (!url.toLowerCase().startsWith('file:///')) {
+    shell.openExternal(url);
+  }
 }
 
 export function setAutoLaunch(value: boolean): void {


Test patch:
diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml
index 44d1cf7d..3cffcf69 100644
--- a/.github/workflows/run-tests.yml
+++ b/.github/workflows/run-tests.yml
@@ -13,7 +13,7 @@ jobs:
 
     steps:
       - uses: actions/checkout@v4
-      - uses: pnpm/action-setup@v2
+      - uses: pnpm/action-setup@v3
       - uses: actions/setup-node@v4
         with:
           node-version-file: '.nvmrc'
diff --git a/src/utils/comms.test.ts b/src/utils/comms.test.ts
index 166f5d93..4a9edb03 100644
--- a/src/utils/comms.test.ts
+++ b/src/utils/comms.test.ts
@@ -41,6 +41,11 @@ describe('utils/comms.ts', () => {
     expect(shell.openExternal).toHaveBeenCalledWith('http://www.gitify.io/');
   });
 
+  it('should ignore opening external local links file:///', () => {
+    openExternalLink('file:///Applications/SomeApp.app');
+    expect(shell.openExternal).toHaveBeenCalledTimes(0);
+  });
+
   it('should setAutoLaunch (true)', () => {
     setAutoLaunch(true);