fix: use @actions/core.exportVariable instead of set-env (#18)

`set-env` is now deprecated. `@actions/core` exposes `exportVariable`
to be used instead.

https://github.com/actions/toolkit/tree/main/packages/core#exporting-variables
This commit is contained in:
Stig Otnes Kolstad 2020-10-08 10:13:24 +02:00 committed by GitHub
parent c70c4ca5c2
commit 2b166600e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 123 additions and 124 deletions

View File

@ -9,8 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.run = void 0;
const core = require("@actions/core");
const command_1 = require("@actions/core/lib/command");
const path = require("path");
const fs = require("fs");
const io = require("@actions/io");
@ -113,7 +113,7 @@ function run() {
core.debug(`Writing kubeconfig contents to ${kubeconfigPath}`);
fs.writeFileSync(kubeconfigPath, kubeconfig);
fs.chmodSync(kubeconfigPath, '600');
command_1.issueCommand('set-env', { name: 'KUBECONFIG' }, kubeconfigPath);
core.exportVariable('KUBECONFIG', kubeconfigPath);
console.log('KUBECONFIG environment variable is set');
yield setContext(kubeconfigPath);
});

View File

@ -1,5 +1,4 @@
import * as core from '@actions/core';
import { issueCommand } from '@actions/core/lib/command';
import * as path from 'path';
import * as fs from 'fs';
import * as io from '@actions/io';
@ -109,7 +108,7 @@ export async function run() {
core.debug(`Writing kubeconfig contents to ${kubeconfigPath}`);
fs.writeFileSync(kubeconfigPath, kubeconfig);
fs.chmodSync(kubeconfigPath, '600');
issueCommand('set-env', { name: 'KUBECONFIG' }, kubeconfigPath);
core.exportVariable('KUBECONFIG', kubeconfigPath);
console.log('KUBECONFIG environment variable is set');
await setContext(kubeconfigPath);
}