use module
This commit is contained in:
parent
17b23b7e6b
commit
85c2e8d21d
15
index.js
15
index.js
@ -1,15 +0,0 @@
|
|||||||
import core from '@actions/core';
|
|
||||||
import github from '@actions/github';
|
|
||||||
|
|
||||||
try {
|
|
||||||
// `who-to-greet` input defined in action metadata file
|
|
||||||
const nameToGreet = core.getInput('who-to-greet');
|
|
||||||
console.log(`Hello ${nameToGreet}!`);
|
|
||||||
const time = (new Date()).toTimeString();
|
|
||||||
core.setOutput("time", time);
|
|
||||||
// Get the JSON webhook payload for the event that triggered the workflow
|
|
||||||
const payload = JSON.stringify(github.context.payload, undefined, 2)
|
|
||||||
console.log(`The event payload: ${payload}`);
|
|
||||||
} catch (error) {
|
|
||||||
core.setFailed(error.message);
|
|
||||||
}
|
|
@ -2,9 +2,10 @@
|
|||||||
"name": "python-packs",
|
"name": "python-packs",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "index.js",
|
"type": "module",
|
||||||
|
"main": "src/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
"dev": "node src/index.js"
|
||||||
},
|
},
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
"author": "",
|
"author": "",
|
||||||
|
28
src/index.js
Normal file
28
src/index.js
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
import core from '@actions/core';
|
||||||
|
import github from '@actions/github';
|
||||||
|
import execSync from 'child_process';
|
||||||
|
|
||||||
|
function ensure_pip() {
|
||||||
|
// call "python3 -m ensurepip"
|
||||||
|
execSync('python3 -m ensurepip');
|
||||||
|
}
|
||||||
|
|
||||||
|
function greeting() {
|
||||||
|
try {
|
||||||
|
// `who-to-greet` input defined in action metadata file
|
||||||
|
const nameToGreet = core.getInput('who-to-greet');
|
||||||
|
console.log(`Hello ${nameToGreet}!`);
|
||||||
|
const time = (new Date()).toTimeString();
|
||||||
|
core.setOutput("time", time);
|
||||||
|
// Get the JSON webhook payload for the event that triggered the workflow
|
||||||
|
const payload = JSON.stringify(github.context.payload, undefined, 2)
|
||||||
|
console.log(`The event payload: ${payload}`);
|
||||||
|
} catch (error) {
|
||||||
|
core.setFailed(error.message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function main() {
|
||||||
|
greeting();
|
||||||
|
ensure_pip();
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user