Compare commits

...

2 Commits

Author SHA1 Message Date
MoChilia
2431008d0a test update node 16 to 20 2024-02-19 11:31:25 +08:00
Shiying Chen
aeb0c3630a Fix #403: Catch the error thrown in pre and post steps (#407)
* fix #403

* modify error handling
2024-01-17 17:37:07 +08:00
8 changed files with 20 additions and 26 deletions

View File

@@ -21,10 +21,10 @@ jobs:
- name: 'Checking out repo code'
uses: actions/checkout@v4
- name: Set Node.js 16.x for GitHub Action
- name: Set Node.js 20.x for GitHub Action
uses: actions/setup-node@v4
with:
node-version: 16.x
node-version: 20.x
- name: 'Validate build'
run: |
@@ -84,10 +84,10 @@ jobs:
- name: 'Checking out repo code'
uses: actions/checkout@v4
- name: Set Node.js 16.x for GitHub Action
- name: Set Node.js 20.x for GitHub Action
uses: actions/setup-node@v4
with:
node-version: 16.x
node-version: 20.x
- name: 'Validate build'
run: |
@@ -345,10 +345,10 @@ jobs:
- name: 'Checking out repo code'
uses: actions/checkout@v4
- name: Set Node.js 16.x for GitHub Action
- name: Set Node.js 20.x for GitHub Action
uses: actions/setup-node@v4
with:
node-version: 16.x
node-version: 20.x
- name: 'Validate build'
run: |

View File

@@ -20,10 +20,10 @@ jobs:
- name: 'Checking out repo code'
uses: actions/checkout@v4
- name: Set Node.js 16.x for GitHub Action
- name: Set Node.js 20.x for GitHub Action
uses: actions/setup-node@v4
with:
node-version: 16.x
node-version: 20.x
- name: 'Validate build'
run: |
@@ -116,10 +116,10 @@ jobs:
- name: 'Checking out repo code'
uses: actions/checkout@v4
- name: Set Node.js 16.x for GitHub Action
- name: Set Node.js 20.x for GitHub Action
uses: actions/setup-node@v4
with:
node-version: 16.x
node-version: 20.x
- name: 'Validate build'
run: |
@@ -256,10 +256,10 @@ jobs:
- name: 'Checking out repo code'
uses: actions/checkout@v4
- name: Set Node.js 16.x for GitHub Action
- name: Set Node.js 20.x for GitHub Action
uses: actions/setup-node@v4
with:
node-version: 16.x
node-version: 20.x
- name: 'Validate build'
run: |

View File

@@ -16,11 +16,11 @@ jobs:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
# Using 16.x version as an example
- name: Set Node.js 16.x for GitHub Action
# Using 20.x version as an example
- name: Set Node.js 20.x for GitHub Action
uses: actions/setup-node@v4
with:
node-version: 16.x
node-version: 20.x
- name: installing node_modules
run: npm install

View File

@@ -20,10 +20,10 @@ jobs:
- name: 'Checking out repo code'
uses: actions/checkout@v4
- name: Set Node.js 16.x for GitHub Action
- name: Set Node.js 20.x for GitHub Action
uses: actions/setup-node@v4
with:
node-version: 16.x
node-version: 20.x
- name: 'Validate build'
run: |

View File

@@ -11,7 +11,7 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 16.x
node-version: 20.x
- name: Run Markdownlint
run: |
npm i -g markdownlint-cli2

View File

@@ -38,7 +38,7 @@ branding:
icon: 'login.svg'
color: 'blue'
runs:
using: 'node16'
using: 'node20'
pre: 'lib/cleanup.js'
main: 'lib/main.js'
post: 'lib/cleanup.js'

View File

@@ -10,7 +10,7 @@ async function cleanup() {
}
}
catch (error) {
core.setFailed(`Login cleanup failed with ${error}. Make sure 'az' is installed on the runner. If 'enable-AzPSSession' is true, make sure 'pwsh' is installed on the runner together with Azure PowerShell module.`);
core.warning(`Login cleanup failed with ${error}. Cleanup will be skipped.`);
core.debug(error.stack);
}
}

View File

@@ -13,9 +13,6 @@ export function setUserAgent(): void {
export async function cleanupAzCLIAccounts(): Promise<void> {
let azPath = await io.which("az", true);
if (!azPath) {
throw new Error("Azure CLI is not found in the runner.");
}
core.debug(`Azure CLI path: ${azPath}`);
core.info("Clearing azure cli accounts from the local cache.");
await exec.exec(`"${azPath}"`, ["account", "clear"]);
@@ -23,9 +20,6 @@ export async function cleanupAzCLIAccounts(): Promise<void> {
export async function cleanupAzPSAccounts(): Promise<void> {
let psPath: string = await io.which(AzPSConstants.PowerShell_CmdName, true);
if (!psPath) {
throw new Error("PowerShell is not found in the runner.");
}
core.debug(`PowerShell path: ${psPath}`);
core.debug("Importing Azure PowerShell module.");
AzPSUtils.setPSModulePathForGitHubRunner();