{"id":29145926,"url":"https://github.com/pkgdeps/git-tag-action","last_synced_at":"2025-06-30T21:09:04.211Z","repository":{"id":40703774,"uuid":"230209561","full_name":"pkgdeps/git-tag-action","owner":"pkgdeps","description":"[GitHub Action] Get ${version} from package.json and git tag ${version} for the repository.","archived":false,"fork":false,"pushed_at":"2025-04-14T04:59:36.000Z","size":1400,"stargazers_count":31,"open_issues_count":1,"forks_count":7,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-30T14:08:37.498Z","etag":null,"topics":["git","github-actions","releases","tag"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/pkgdeps.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"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,"zenodo":null}},"created_at":"2019-12-26T06:36:56.000Z","updated_at":"2025-06-25T16:01:17.000Z","dependencies_parsed_at":"2024-10-25T04:18:11.921Z","dependency_job_id":"8faabf3c-3503-43fb-884e-936962636784","html_url":"https://github.com/pkgdeps/git-tag-action","commit_stats":{"total_commits":73,"total_committers":4,"mean_commits":18.25,"dds":0.1643835616438356,"last_synced_commit":"4fb7f39c044981bb51f2079366e4b571ea5a9a02"},"previous_names":[],"tags_count":36,"template":false,"template_full_name":null,"purl":"pkg:github/pkgdeps/git-tag-action","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pkgdeps%2Fgit-tag-action","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pkgdeps%2Fgit-tag-action/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pkgdeps%2Fgit-tag-action/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pkgdeps%2Fgit-tag-action/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pkgdeps","download_url":"https://codeload.github.com/pkgdeps/git-tag-action/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pkgdeps%2Fgit-tag-action/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262850294,"owners_count":23374356,"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":["git","github-actions","releases","tag"],"created_at":"2025-06-30T21:09:03.379Z","updated_at":"2025-06-30T21:09:04.196Z","avatar_url":"https://github.com/pkgdeps.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pkgdeps/git-tag-action [![Actions Status: Release](https://github.com/pkgdeps/git-tag-action/workflows/Release/badge.svg)](https://github.com/pkgdeps/git-tag-action/actions?query=workflow%3A\"Release\") [![Actions Status: test](https://github.com/pkgdeps/git-tag-action/workflows/test/badge.svg)](https://github.com/pkgdeps/git-tag-action/actions?query=workflow%3A\"test\")\n\nThis action do `git tag ${version}` to the repository, but it is idempotent. \n\n- Push the tag if the tag does not exist on the repository\n\n## Usage\n\nYou create workflow file like `.github/workflows/publish.yml`.\n\n```yml\nname: publish\nenv:\n  CI: true\non:\n  push:\n    branches:\n      - master\n    tags:\n      - \"!*\"\njobs:\n  release:\n    name: Setup\n    runs-on: ubuntu-latest\n    steps:\n      - name: checkout\n        uses: actions/checkout@v3\n      - name: setup Node\n        uses: actions/setup-node@v3\n      - name: package-version-to-git-tag\n        uses: pkgdeps/git-tag-action@v2\n        with:\n          github_token: ${{ secrets.GITHUB_TOKEN }}\n          github_repo: ${{ github.repository }}\n          git_commit_sha: ${{ github.sha }}\n          version: \"1.0.0\"\n          git_tag_prefix: \"v\"\n```\n\n## UseCase\n\n1. [Manual] Update Version: `npm --no-git-tag-version version {patch,minor,major}`\n2. [Manual] Push: `git push --tags` or Merge the Pull Request\n3. [CI] Publish to npm and Push a tag to GitHub  \n\nThis Release flow is defined in [.github/workflows/publish.yml](./.github/workflows/publish.yml)\n\n```yaml\nname: publish\nenv:\n  CI: true\non:\n  push:\n    branches:\n      - master\n    tags:\n      - \"!*\"\njobs:\n  release:\n    name: Setup\n    runs-on: ubuntu-latest\n    steps:\n      - name: checkout\n        uses: actions/checkout@v2\n      - name: setup Node\n        uses: actions/setup-node@v2\n        with:\n          node-version: 14.x\n          registry-url: 'https://npm.pkg.github.com'\n      - name: install\n        run: npm install\n      - name: test\n        run: npm test\n      # Publish to npm if this version is not published\n      - name: publish\n        run: |\n          npx can-npm-publish --verbose \u0026\u0026 npm publish || echo \"Does not publish\"\n        env:\n          NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n      # Push tag to GitHub if package.json version's tag is not tagged\n      - name: package-version\n        run: node -p -e '`PACKAGE_VERSION=${require(\"./package.json\").version}`' \u003e\u003e $GITHUB_ENV\n      - name: package-version-to-git-tag\n        uses: pkgdeps/git-tag-action@v2\n        with:\n          github_token: ${{ secrets.GITHUB_TOKEN }}\n          github_repo: ${{ github.repository }}\n          version: ${{ env.PACKAGE_VERSION }}\n          git_commit_sha: ${{ github.sha }}\n          git_tag_prefix: \"v\"\n```\n\nFor more details, see following example\n\n- [azu/npm-github-package-example: npm registry to GitHub Package Registry example.](https://github.com/azu/npm-github-package-example)\n\n## Options\n\n```yaml\ninputs:\n  version:\n    description: 'Git Tag version'\n    required: true\n  github_token:\n    description: 'use secrets.GITHUB_TOKEN'\n    required: true\n  git_commit_sha:\n    description: 'Git commit SHA'\n    required: false\n  git_tag_prefix:\n    description: \"prefix for git tag. Example) 'v'\"\n    required: false\n    default: \"\"\n  github_repo:\n    description: 'GitHub repository path. Example) azu/test'\n    required: true\n```\n\n## Release\n\n1. https://github.com/pkgdeps/git-tag-action\n2. Create new tag like \"v2.0.0\"\n3. CI publish \"v2.0.0\", \"v2.0\", and \"v2\"\n\n## CHANGELOG\n\n- 2.0.0: tag is annotated tag instead of lightweight tag\n    - Rename `action-package-version-to-git-tag` to `git-tag-action`\n\n## Reference\n\n- [GitHub Actionsでnpmに自動でリリースするworkflowを作ってみた ｜ Developers.IO](https://dev.classmethod.jp/etc/github-actions-npm-automatic-release/)\n\n## FAQ\n\n### Error: npm ERR! code E401\n\nOccur following error:\n\n```\nnpx: installed 57 in 6.945s\nnpm ERR! code E401\nnpm ERR! Unable to authenticate, need: Basic realm=\"GitHub Package Registry\"\n\nnpm ERR! A complete log of this run can be found in:\nnpm ERR!     /github/home/.npm/_logs/2019-12-26T08_02_20_108Z-debug.log\n```\n\nPlease check `NODE_AUTH_TOKEN`\n\n```\n  env:\n    NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpkgdeps%2Fgit-tag-action","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpkgdeps%2Fgit-tag-action","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpkgdeps%2Fgit-tag-action/lists"}