{"id":16539475,"url":"https://github.com/rickstaa/action-contains-tag","last_synced_at":"2025-03-21T09:32:20.717Z","repository":{"id":39866648,"uuid":"329024664","full_name":"rickstaa/action-contains-tag","owner":"rickstaa","description":"Simple GitHub action that can be used to check if a commit or branch contains a given tag.","archived":false,"fork":false,"pushed_at":"2025-01-23T22:02:35.000Z","size":52,"stargazers_count":7,"open_issues_count":4,"forks_count":4,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-18T00:01:29.303Z","etag":null,"topics":["continious-integration","docker","gh-actions","github-actions-docker","tagging","utilities"],"latest_commit_sha":null,"homepage":"https://github.com/marketplace/actions/contains-tag","language":"Shell","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/rickstaa.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","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":["rickstaa"]}},"created_at":"2021-01-12T15:11:32.000Z","updated_at":"2025-01-23T22:02:39.000Z","dependencies_parsed_at":"2024-10-28T10:17:23.121Z","dependency_job_id":"652c315f-fa36-4d4e-bcd7-52b6cac56858","html_url":"https://github.com/rickstaa/action-contains-tag","commit_stats":{"total_commits":61,"total_committers":4,"mean_commits":15.25,"dds":"0.11475409836065575","last_synced_commit":"4db00c28452328241296e4f3ed7175a13fdeffa8"},"previous_names":[],"tags_count":31,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rickstaa%2Faction-contains-tag","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rickstaa%2Faction-contains-tag/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rickstaa%2Faction-contains-tag/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rickstaa%2Faction-contains-tag/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rickstaa","download_url":"https://codeload.github.com/rickstaa/action-contains-tag/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244772642,"owners_count":20508031,"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":["continious-integration","docker","gh-actions","github-actions-docker","tagging","utilities"],"created_at":"2024-10-11T18:49:11.242Z","updated_at":"2025-03-21T09:32:20.282Z","avatar_url":"https://github.com/rickstaa.png","language":"Shell","funding_links":["https://github.com/sponsors/rickstaa"],"categories":[],"sub_categories":[],"readme":"# GitHub Action: Contains tag\n\n[![Docker Image CI](https://github.com/rickstaa/action-contains-tag/workflows/Docker%20Image%20CI/badge.svg)](https://github.com/rickstaa/action-contains-tag/actions)\n[![Code quality CI](https://github.com/rickstaa/action-contains-tag/workflows/Code%20quality%20CI/badge.svg)](https://github.com/rickstaa/action-contains-tag/actions?query=workflow%3A%22Code+quality+CI%22)\n[![release](https://github.com/rickstaa/action-contains-tag/workflows/release/badge.svg)](https://github.com/rickstaa/action-contains-tag/actions?query=workflow%3Arelease)\n[![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/rickstaa/action-contains-tag?logo=github\u0026sort=semver)](https://github.com/rickstaa/action-contains-tag/releases)\n\nSimple GitHub action that can be used to check if a commit or branch contains a given tag.\n\n## Inputs\n\n### `tag`\n\n**Required**. The tag you want to check. Also works with `${{ github.ref }}` if the workflow was triggered on a tag push.\n\n### `reference`\n\n**Required**. Branch or commit for which you want to check the tag existence.\n\n### `verbose`\n\n**Optional**. Log action information to the console. By default `true`.\n\n### `frail`\n\n**Optional**. Return an exit code of `1` when tag or reference does not exist. By default `true`.\n\n## Outputs\n\n### `retval`\n\nBoolean specifying whether the reference contained the tag.\n\n### `tag`\n\nThe (trimmed) input tag that as used as a input.\n\n### `linked_commit`\n\nThe commit that is currently linked to the tag.\n\n### `reference`\n\nThe reference that was used as a input.\n\n## Example usage\n\n```yml\nname: Contains tag\non:\n  push:\n    branch: \"main\"\njobs:\n  create-tag:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v3\n        with:\n          fetch-depth: 0\n      - uses: rickstaa/action-contains-tag@v1\n        id: contains_tag\n        with:\n          reference: \"main\"\n          tag: \"Latest\"\n      - run: |\n          if [[ ${{ steps.contains_tag.outputs.retval }} != 'true' ]]; then\n            echo \"Branch/commit did contain the tag.\"\n          else\n            echo \"Branch/commit did not contain the tag.\"\n          fi\n```\n\n## Use case\n\nI created this action since I wanted to combine the `tag` and `push` to branch filters. I send a feature request to the GitHub support. Until this feature is released, this action can be used as a temporary workaround. The recipe below ensures that a workflow is only triggered when a tag is pushed to the master branch.\n\n```yml\nname: Github tag test\non:\n  push:\n    tags:\n      - \"v*.*.*\"\njobs:\n  on-main-branch-check:\n    runs-on: ubuntu-latest\n    outputs:\n      on_main: ${{ steps.contains_tag.outputs.retval }}\n    steps:\n      - uses: actions/checkout@v3\n        with:\n          fetch-depth: 0\n      - uses: rickstaa/action-contains-tag@v1\n        id: contains_tag\n        with:\n          reference: \"main\"\n          tag: \"${{ github.ref }}\"\n  tag-on-main-job:\n    runs-on: ubuntu-latest\n    needs: on-main-branch-check\n    if: ${{ needs.on-main-branch-check.outputs.on_main == 'true' }}\n    steps:\n      - run: echo \"Tag was pushed to main.\"\n      - run: echo ${{needs.on-main-branch-check.outputs.on_main}}\n  tag-not-on-main-job:\n    runs-on: ubuntu-latest\n    needs: on-main-branch-check\n    if: ${{ needs.on-main-branch-check.outputs.on_main != 'true' }}\n    steps:\n      - run: echo \"Tag was not pushed to main.\"\n      - run: echo ${{needs.on-main-branch-check.outputs.on_main}}\n```\n\n## Limitations \u0026 Gotchas\n\nWhen use [Checkout@v3](https://github.com/actions/checkout), only a single commit is fetched by default. You must therefore set the right `fetch_depth` in order to be able to access all the tags.\n\n## Contributing\n\nFeel free to open an issue if you have ideas on how to make this GitHub action better or if you want to report a bug! All contributions are welcome. :rocket: Please consult the [contribution guidelines](CONTRIBUTING.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frickstaa%2Faction-contains-tag","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frickstaa%2Faction-contains-tag","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frickstaa%2Faction-contains-tag/lists"}