duoops 0.2.5 → 0.2.6

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.
@@ -24,10 +24,13 @@ const hasBinary = (command) => {
24
24
  const detectGlabToken = (host = 'gitlab.com') => {
25
25
  try {
26
26
  const token = execSync(`glab config get token --host ${host}`, { encoding: 'utf8', stdio: ['pipe', 'pipe', 'ignore'] }).trim();
27
- if (token)
27
+ if (!token)
28
+ return;
29
+ const status = execSync(`curl -sf -o /dev/null -w "%{http_code}" -H "Authorization: Bearer ${token}" "https://${host}/api/v4/user"`, { encoding: 'utf8', stdio: ['pipe', 'pipe', 'ignore'], timeout: 5000 }).trim();
30
+ if (status === '200')
28
31
  return { source: 'glab CLI', token };
29
32
  }
30
- catch { /* glab not installed or not authenticated */ }
33
+ catch { /* glab not installed, not authenticated, or token expired */ }
31
34
  };
32
35
  const detectGitRemotePath = () => {
33
36
  try {
@@ -669,5 +669,5 @@
669
669
  ]
670
670
  }
671
671
  },
672
- "version": "0.2.5"
672
+ "version": "0.2.6"
673
673
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "duoops",
3
3
  "description": "Toolset for Explainable and Sustainable CI on Gitlab.",
4
- "version": "0.2.5",
4
+ "version": "0.2.6",
5
5
  "author": "Younes Laaroussi",
6
6
  "bin": {
7
7
  "duoops": "./bin/run.js"