From f7d8405b010a49edc5be9419f70929a7d778ad2a Mon Sep 17 00:00:00 2001 From: Erik Sundell Date: Thu, 15 Apr 2021 17:41:18 +0200 Subject: [PATCH 1/4] Documentation tweaks to action.yml / README.md pre-publishing --- README.md | 4 ++++ action.yml | 26 ++++++++++++++++++++------ 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 3825327..f784183 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,10 @@ The GitHub action's only output is named `tags` and is a JSON formatted list. Se This can be useful for running a workflow in pull requests where no suitable git references are present. `prefix` is _not_ automatically added. +## Output parameters + +- `tags`: A JSON formatted list of calculated tags. + ## Example workflow ```yaml diff --git a/action.yml b/action.yml index f1a49bc..8ded008 100644 --- a/action.yml +++ b/action.yml @@ -1,22 +1,36 @@ +# Reference: https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions +--- +author: Simon Li name: major-minor-tag-calculator description: Calculate major and minor semver tags, e.g. for tagging containers -author: Simon Li + +# Manually keep the input-, and output- descriptions in sync with the readme! inputs: githubToken: - required: false - description: GitHub token + required: true + description: |- + The GitHub token, required so this action can fetch tags using the GitHub API. default: "" prefix: required: false - description: Prefix each tag with this string, e.g. "docker/repository:" + description: |- + A string that each returned tag should be prefixed with, for example to tag a Docker container set this to `user/repository:`. default: "" defaultTag: required: false - description: If the tag output would be empty return this tag instead + description: |- + If the tag output would be empty return this tag instead. + This can be useful for running a workflow in pull requests where no suitable git references are present. + `prefix` is _not_ automatically added. default: "" outputs: tags: - description: List of calculated tags + description: A JSON formatted list of calculated tags. + runs: using: node12 main: dist/index.js + +branding: + icon: bookmark + color: purple From 9453fbba721561b1e39f9bfa6be18adb64c651e1 Mon Sep 17 00:00:00 2001 From: Simon Li Date: Thu, 15 Apr 2021 19:51:56 +0100 Subject: [PATCH 2/4] githubToken recommended but not required --- README.md | 4 ++-- action.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index f784183..bd5232f 100644 --- a/README.md +++ b/README.md @@ -22,9 +22,9 @@ The GitHub action's only output is named `tags` and is a JSON formatted list. Se | `1.2.3-alpha.1` | `1.2.0` | `"[1.2.3-alpha.1]"` | A pre-release suffix on a version is treated like a branch | | `1.2.3-4` | `1.2.0`, `1.2.3` | `"[1.2.3-4, 1.2.3, 1.2, 1, latest]"` | A build number suffix on a version is treated like the version but even newer | -## Required input parameters +## Recommended input parameters -- `githubToken`: The GitHub token, required so this action can fetch tags using the GitHub API. +- `githubToken`: The GitHub token, required so this action can fetch tags using the GitHub API. If this this parameter is not set then `defaultTag` (if set) or an empty list will be returned. ## Optional input parameters diff --git a/action.yml b/action.yml index 8ded008..611522a 100644 --- a/action.yml +++ b/action.yml @@ -7,9 +7,9 @@ description: Calculate major and minor semver tags, e.g. for tagging containers # Manually keep the input-, and output- descriptions in sync with the readme! inputs: githubToken: - required: true + required: false description: |- - The GitHub token, required so this action can fetch tags using the GitHub API. + The GitHub token, required so this action can fetch tags using the GitHub API. If this this parameter is not set then `defaultTag` (if set) or an empty list will be returned. default: "" prefix: required: false From ec298d00e572552bd0884f3e8c869887f210a787 Mon Sep 17 00:00:00 2001 From: Simon Li Date: Wed, 14 Apr 2021 23:00:19 +0100 Subject: [PATCH 3/4] Tags always in decreasing order of specificity --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bd5232f..d728245 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ This pattern is often used for tagging containers. ## Example output -The GitHub action's only output is named `tags` and is a JSON formatted list. See the example workflow below for details on how to convert the JSON formatted list to something else. +The GitHub action's only output is named `tags` and is a JSON formatted list. See the example workflow below for details on how to convert the JSON formatted list to something else. Tags will always be in decreasing order of specificity. | Pushed reference | GitHub repo tags | `tags` output | Comment | | ---------------- | ---------------- | ------------------------------------ | ----------------------------------------------------------------------------- | From 69d3a25098e066533adec27fd7e0d2e84c72991f Mon Sep 17 00:00:00 2001 From: Simon Li Date: Thu, 15 Apr 2021 20:08:03 +0100 Subject: [PATCH 4/4] fix typo --- README.md | 2 +- action.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d728245..11da5e4 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ The GitHub action's only output is named `tags` and is a JSON formatted list. Se ## Recommended input parameters -- `githubToken`: The GitHub token, required so this action can fetch tags using the GitHub API. If this this parameter is not set then `defaultTag` (if set) or an empty list will be returned. +- `githubToken`: The GitHub token, required so this action can fetch tags using the GitHub API. If this parameter is not set then `defaultTag` (if set) or an empty list will be returned. ## Optional input parameters diff --git a/action.yml b/action.yml index 611522a..b4c3d07 100644 --- a/action.yml +++ b/action.yml @@ -9,7 +9,7 @@ inputs: githubToken: required: false description: |- - The GitHub token, required so this action can fetch tags using the GitHub API. If this this parameter is not set then `defaultTag` (if set) or an empty list will be returned. + The GitHub token, required so this action can fetch tags using the GitHub API. If this parameter is not set then `defaultTag` (if set) or an empty list will be returned. default: "" prefix: required: false