mirror of
https://github.com/ditkrg/project-version-check.git
synced 2026-01-22 22:06:42 +00:00
Add file path as input
Signed-off-by: Shakar <5h4k4r.b4kr@gmail.com>
This commit is contained in:
parent
74f60450b3
commit
ffd7d9f105
2
.github/workflows/main.yaml
vendored
2
.github/workflows/main.yaml
vendored
@ -28,6 +28,8 @@ jobs:
|
|||||||
id: hello
|
id: hello
|
||||||
with:
|
with:
|
||||||
label: minor
|
label: minor
|
||||||
|
filePath: /package.json
|
||||||
|
|
||||||
# ${{ github.event.label.name }}
|
# ${{ github.event.label.name }}
|
||||||
- name: Get the output time
|
- name: Get the output time
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
12
index.js
12
index.js
@ -4,11 +4,21 @@ const fs = require('fs')
|
|||||||
const xml2js = require('xml2js')
|
const xml2js = require('xml2js')
|
||||||
try {
|
try {
|
||||||
const label = core.getInput('label');
|
const label = core.getInput('label');
|
||||||
|
const filePath = core.getInput('filePath');
|
||||||
|
|
||||||
console.log(`Label: ${label}`)
|
console.log(`Label: ${label}`)
|
||||||
|
console.log(`File path: ${filePath}`)
|
||||||
|
|
||||||
core.setOutput("label", label);
|
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
|
// the version is in semantic format, so we can split it by dot
|
||||||
const versionParts = version.split('.');
|
const versionParts = version.split('.');
|
||||||
if (label === 'major') {
|
if (label === 'major') {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user