Skip to content

Commit

Permalink
Merge pull request #68 from consideRatio/pr/docs-to-action-definition…
Browse files Browse the repository at this point in the history
…-and-readme-pre-publishing

Documentation tweaks to action.yml / README.md pre-publishing
  • Loading branch information
manics authored Apr 15, 2021
2 parents 7283607 + 69d3a25 commit 35966da
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 8 deletions.
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
| ---------------- | ---------------- | ------------------------------------ | ----------------------------------------------------------------------------- |
Expand All @@ -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 parameter is not set then `defaultTag` (if set) or an empty list will be returned.

## Optional input parameters

Expand All @@ -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
Expand Down
24 changes: 19 additions & 5 deletions action.yml
Original file line number Diff line number Diff line change
@@ -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
description: |-
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
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

0 comments on commit 35966da

Please sign in to comment.