From 50354d2a7f7bb490579d8c5ee489c0e0a4ee98e7 Mon Sep 17 00:00:00 2001 From: Corey Butler Date: Mon, 2 Sep 2019 18:49:51 -0500 Subject: [PATCH] WIP --- README.md | 13 ++++++++++++- lib/main.js | 3 ++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 66bd219..ec4ba68 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Autotag -Outputs: tag - empty if no tag is created. +This action will read a `package.json` file found in the project root ## Usage @@ -52,6 +52,17 @@ The action will automatically extract the token at runtime. **DO NOT MANUALLY EN There are several options to customize how the tag is created. +1. `package_root` + + By default, autotag will look for the `package.json` file in the project root. If the file is located in a subdirectory, this option an be used to point to the correct file. + + ```yaml + - uses: butlerlogic/action-autotag@1.0.0 + with: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + package_root: "/path/to/subdirectory" + ``` + 1. `tag_prefx` By default, `package.json` uses [semantic versioning](https://semver.org/), such as `1.0.0`. A prefix can be used to add text before the tag name. For example, if `tag_prefx` is set to `v`, then the tag would be labeled as `v1.0.0`. diff --git a/lib/main.js b/lib/main.js index 15d754c..b90ea0a 100644 --- a/lib/main.js +++ b/lib/main.js @@ -14,7 +14,8 @@ async function run() { core.debug(` Working Directory: ${process.env.GITHUB_WORKSPACE}:\n${dir}`) - let pkgfile = path.join(process.env.GITHUB_WORKSPACE, 'package.json') + const pkg_root = core.getInput('package_root', { required: false }) + let pkgfile = path.join(process.env.GITHUB_WORKSPACE, pkg_root, 'package.json') if (!fs.existsSync(pkgfile)) { core.setFailed('package.json does not exist.')