{"id":14985965,"url":"https://github.com/wyrihaximus/github-action-get-previous-tag","last_synced_at":"2025-05-14T22:10:07.440Z","repository":{"id":42050803,"uuid":"216229397","full_name":"WyriHaximus/github-action-get-previous-tag","owner":"WyriHaximus","description":"Get the previous tag","archived":false,"fork":false,"pushed_at":"2024-11-03T17:22:12.000Z","size":178,"stargazers_count":191,"open_issues_count":9,"forks_count":52,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-13T23:16:10.332Z","etag":null,"topics":["action","git","github","github-actions","hacktoberfest","tag"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/WyriHaximus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"WyriHaximus"}},"created_at":"2019-10-19T15:39:18.000Z","updated_at":"2025-04-25T16:46:51.000Z","dependencies_parsed_at":"2024-01-28T16:24:41.889Z","dependency_job_id":"405e298d-6fb6-42df-bd1a-6e6b119aee74","html_url":"https://github.com/WyriHaximus/github-action-get-previous-tag","commit_stats":{"total_commits":59,"total_committers":14,"mean_commits":4.214285714285714,"dds":0.576271186440678,"last_synced_commit":"a8f2215feac0522ff78eba734c1e91e5b59fb434"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WyriHaximus%2Fgithub-action-get-previous-tag","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WyriHaximus%2Fgithub-action-get-previous-tag/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WyriHaximus%2Fgithub-action-get-previous-tag/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WyriHaximus%2Fgithub-action-get-previous-tag/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WyriHaximus","download_url":"https://codeload.github.com/WyriHaximus/github-action-get-previous-tag/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254235701,"owners_count":22036964,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["action","git","github","github-actions","hacktoberfest","tag"],"created_at":"2024-09-24T14:12:03.105Z","updated_at":"2025-05-14T22:10:02.411Z","avatar_url":"https://github.com/WyriHaximus.png","language":"JavaScript","funding_links":["https://github.com/sponsors/WyriHaximus"],"categories":[],"sub_categories":[],"readme":"# Get previous tag\n\n\n[![Continuous Integration](https://github.com/WyriHaximus/github-action-get-previous-tag/actions/workflows/ci.yml/badge.svg)](https://github.com/WyriHaximus/github-action-get-previous-tag/actions/workflows/ci.yml)\n[![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/WyriHaximus/github-action-get-previous-tag?logo=github\u0026sort=semver)](https://github.com/WyriHaximus/github-action-get-previous-tag/releases)\n\n\nGitHub Action that gets the latest tag from Git\n\n![Example output showing this action in action](images/output.png)\n\n## Input\n\nBy default, this action will fail if no tag can be found, however, it accepts a `fallback` tag that will be used when no \ntag can be found. Keep in mind that when this action is used in a workflow that has no `.git` directory, it will still \nfail, and the fallback tag isn't used.  It is also accepts a `prefix` string to query the tags based on it. And finally \nit takes a `workingDirectory` if you need to look for a tag in an alternative path.\n\n* `fallback`: `1.0.0`\n* `prefix`: `tag-prefix`\n* `workingDirectory`: `another/path/where/a/git/repo/is/checked/out`\n\n## Output\n\nThis action has two outputs, `tag` for the found tag, or the fallback. And, `timestamp` as a UNIX Epoch timestmap for \nwhen the tag was created, or when no tag is found, and a fallback tag has be specific is provides the timestamp of \naction execution.\n\n* `tag`: `1.2.3`\n* `timestamp`: `123`\n\n## Example\n\nFind more examples in the [examples directory](./examples/).\n\nThe following example works together with the [`WyriHaximus/github-action-next-semvers`](https://github.com/marketplace/actions/next-semvers) and [`WyriHaximus/github-action-create-milestone`](https://github.com/marketplace/actions/create-milestone) actions.\nWhere 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.\n(This snippet has been taken from the automatic code generation of [`wyrihaximus/fake-php-version`](https://github.com/wyrihaximus/php-fake-php-version/).)\n\n```yaml\nname: Generate\njobs:\n  generate:\n    steps:\n      - uses: actions/checkout@v3\n        with:\n          fetch-depth: 0 # Required due to the way Git works, without it this action won't be able to find any or the correct tags\n      - name: 'Get Previous tag'\n        id: previoustag\n        uses: \"WyriHaximus/github-action-get-previous-tag@v1\"\n        with:\n          fallback: 1.0.0 # Optional fallback tag to use when no tag can be found\n          #workingDirectory: another/path/where/a/git/repo/is/checked/out # Optional alternative working directory\n      - name: 'Get next minor version'\n        id: semvers\n        uses: \"WyriHaximus/github-action-next-semvers@v1\"\n        with:\n          version: ${{ steps.previoustag.outputs.tag }}\n      - name: 'Create new milestone'\n        id: createmilestone\n        uses: \"WyriHaximus/github-action-create-milestone@v1\"\n        with:\n          title: ${{ steps.semvers.outputs.patch }}\n        env:\n          GITHUB_TOKEN: \"${{ secrets.GITHUB_TOKEN }}\"\n```\n\n## License ##\n\nCopyright 2021 [Cees-Jan Kiewiet](http://wyrihaximus.net/)\n\nPermission is hereby granted, free of charge, to any person\nobtaining a copy of this software and associated documentation\nfiles (the \"Software\"), to deal in the Software without\nrestriction, including without limitation the rights to use,\ncopy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the\nSoftware is furnished to do so, subject to the following\nconditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\nOF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\nHOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\nWHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\nOTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwyrihaximus%2Fgithub-action-get-previous-tag","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwyrihaximus%2Fgithub-action-get-previous-tag","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwyrihaximus%2Fgithub-action-get-previous-tag/lists"}