Add file path as input

Signed-off-by: Shakar <5h4k4r.b4kr@gmail.com>
This commit is contained in:
Shakar 2023-09-17 14:24:56 +03:00
parent 74f60450b3
commit ffd7d9f105
No known key found for this signature in database
GPG Key ID: DA55A26823AE3C28
2 changed files with 13 additions and 1 deletions

View File

@ -28,6 +28,8 @@ jobs:
id: hello
with:
label: minor
filePath: /package.json
# ${{ github.event.label.name }}
- name: Get the output time
run: |

View File

@ -4,11 +4,21 @@ const fs = require('fs')
const xml2js = require('xml2js')
try {
const label = core.getInput('label');
const filePath = core.getInput('filePath');
console.log(`Label: ${label}`)
console.log(`File path: ${filePath}`)
core.setOutput("label", label);
const version = require('./package.json').version;
// if (project == 'dotnetcore')
// filePath = `${filePath}/.csproj`;
// else if (project == 'nodejs')
// filePath = `${filePath}/package.json`;
const version = require(filePath).version;
// the version is in semantic format, so we can split it by dot
const versionParts = version.split('.');
if (label === 'major') {