Skip to content

Commit 9f93795

Browse files
fix: #24 drop GitHub API in favor of URL redirect
1 parent 280eabe commit 9f93795

File tree

7 files changed

+14
-99
lines changed

7 files changed

+14
-99
lines changed

package-lock.json

Lines changed: 2 additions & 66 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "azure-devops-bicep-task",
3-
"version": "0.4.4",
3+
"version": "0.4.5",
44
"description": "Tasks for installing Bicep CLI and running Bicep CLI build commands",
55
"main": "index.js",
66
"scripts": {
@@ -38,7 +38,6 @@
3838
"homepage": "https://github.com/piraces/azure-devops-bicep-task#readme",
3939
"dependencies": {
4040
"axios": "^0.27.2",
41-
"axios-retry": "^3.4.0",
4241
"azure-pipelines-task-lib": "^4.2.0",
4342
"azure-pipelines-tool-lib": "^2.0.0-preview",
4443
"glob": "^8.1.0"

src/decompile/task.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"version": {
1717
"Major": 0,
1818
"Minor": 4,
19-
"Patch": 4
19+
"Patch": 5
2020
},
2121
"instanceNameFormat": "Run Bicep CLI decompile command",
2222
"inputs": [

src/install/index.ts

Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,7 @@ import { platform, arch } from 'os';
44
import * as taskLib from 'azure-pipelines-task-lib/task';
55
import * as toolLib from 'azure-pipelines-tool-lib/tool';
66
import { ClientRequest } from 'http';
7-
import axios, { AxiosError } from 'axios';
8-
import axiosRetry from 'axios-retry';
9-
10-
axiosRetry(axios,
11-
{
12-
retries: 3,
13-
retryCondition: (error: AxiosError) => {
14-
if (!error.response || error.response.status >= 400) {
15-
if (error.response) {
16-
taskLib.debug(`Retrying request with status code '${error.response.status}'.`);
17-
taskLib.debug(`Response received: '${JSON.stringify(error.response)}'.`);
18-
}
19-
return true;
20-
}
21-
return false;
22-
}
23-
});
7+
import axios from 'axios';
248

259
export function getDownloadUrl(version: string): string {
2610
const agentPlatform = platform();
@@ -51,13 +35,9 @@ export function getDownloadUrl(version: string): string {
5135

5236
export async function getLatestVersionTag(): Promise<string> {
5337
return await axios
54-
.get('https://api.github.com/repos/Azure/Bicep/releases/latest', {
55-
headers: {
56-
'User-Agent': 'piraces',
57-
},
58-
})
59-
.then(function (response: { data: { tag_name: string } }) {
60-
return response.data.tag_name.replace('v', '');
38+
.get('https://github.com/azure/bicep/releases/latest')
39+
.then(function (response) {
40+
return response.request.path.split('/')[5].replace('v', '');
6141
})
6242
.catch(function (error: {
6343
message: string;
@@ -69,15 +49,15 @@ export async function getLatestVersionTag(): Promise<string> {
6949
// The request was made and the server responded with a status code
7050
// that falls out of the range of 2xx
7151
throw new Error(
72-
`[FATAL] Error while retrieving latest version tag: '${error.message}'.\nResponse: \n-Data: '${JSON.stringify(error.response.data)}' \n-Status: '${error.response.status}' \n-Headers: '${JSON.stringify(error.response.headers)}'`,
52+
`[FATAL] Error while retrieving latest version tag: '${error.message}'.`,
7353
);
7454
} else if (error.request) {
7555
throw new Error(
76-
`[FATAL] Error while retrieving latest version tag: '${error.message}'.\nRequest: '${JSON.stringify(error.request)}'\nConfig: '${error.config}'`,
56+
`[FATAL] Error while retrieving latest version tag: '${error.message}'.`,
7757
);
7858
} else {
7959
throw new Error(
80-
`[FATAL] Error while retrieving latest version tag: '${error.message}'.\nConfig: '${error.config}'`,
60+
`[FATAL] Error while retrieving latest version tag: '${error.message}'.`,
8161
);
8262
}
8363
});

src/install/task.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"version": {
1717
"Major": 0,
1818
"Minor": 4,
19-
"Patch": 4
19+
"Patch": 5
2020
},
2121
"instanceNameFormat": "Install Bicep CLI",
2222
"inputs": [

src/run/task.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"version": {
1717
"Major": 0,
1818
"Minor": 4,
19-
"Patch": 4
19+
"Patch": 5
2020
},
2121
"instanceNameFormat": "Run Bicep CLI build command",
2222
"inputs": [

vss-extension.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"manifestVersion": 1,
33
"id": "bicep-tasks",
4-
"version": "0.4.4",
4+
"version": "0.4.5",
55
"name": "Bicep Tasks",
66
"publisher": "piraces",
77
"description": "Provides Azure DevOps tasks to install and run Microsoft Bicep CLI commands (cross-platform)",

0 commit comments

Comments
 (0)