Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
G

github-action-get-previous-tag

> 开发工具
Open source

Get the previous tag

196 stars0 likes3 views
WebsiteGitHub

About

Get the previous tag

Get previous tag

GitHub Action that gets the latest tag from Git

Input

By default, this action will fail if no tag can be found and no fallback is provided; when set, the fallback tag will be used instead. Keep in mind that when this action is used in a workflow that has no .git directory, it will still fail, and the fallback tag isn't used. It is also accepts a pattern string to query the tags based on it. Pattern to query the tag by this can be semver (v*[0-9].*[0-9].*[0-9]) or a simple monotonically increasing integer (r*) and defaults to * And finally it takes a workingDirectory if you need to look for a tag in an alternative path.

  • fallback: 1.0.0
  • pattern: v*[0-9].*[0-9].*[0-9]
  • workingDirectory: another/path/where/a/git/repo/is/checked/out

Output

This action has two outputs, tag for the found tag, or the fallback. And, timestamp as a UNIX Epoch timestmap for when the tag was created, or when no tag is found, and a fallback tag has be specific is provides the timestamp of action execution.

  • tag: 1.2.3
  • timestamp: 123

Example

Find more examples in the examples directory.

The following example works together with the WyriHaximus/github-action-next-semvers and WyriHaximus/github-action-create-milestone actions. Where it provides the previous tag from that action so it can supply a set of versions for the next action, which creates a new milestone. (This snippet has been taken from the automatic code generation of wyrihaximus/fake-php-version.)

…

License

Copyright 2026 Cees-Jan Kiewiet

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

JavaScriptactiongitgithubgithub-actions

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 18, 2026
Category开发工具
PricingOpen source

> Related tools

V
VS Code
流行的开源代码编辑器
G
Git
分布式版本控制系统
V
Vite
下一代前端构建工具