Add js_action.yaml
This commit is contained in:
23
.gitea/actions/js-action/index.js
Executable file
23
.gitea/actions/js-action/index.js
Executable file
@@ -0,0 +1,23 @@
|
||||
const core = require('@actions/core');
|
||||
const github = require('@actions/github');
|
||||
const fs = require('fs');
|
||||
|
||||
try {
|
||||
// name is from action.yaml (the input)
|
||||
const name = core.getInput('name');
|
||||
console.log(`Arg received from index.js: ${name}`);
|
||||
|
||||
console.log('Workdir from index.js:');
|
||||
fs.readdirSync('.').forEach(file => {
|
||||
console.log(file);
|
||||
});
|
||||
|
||||
// This is how we can get the github context in the action
|
||||
const payload = JSON.stringify(github.context.payload, undefined, 2);
|
||||
console.log(`The event payload: ${payload}`);
|
||||
|
||||
fs.writeFileSync('name.txt', name);
|
||||
core.setOutput('processed-name', name);
|
||||
} catch (error) {
|
||||
core.setFailed(error.message);
|
||||
}
|
||||
Reference in New Issue
Block a user