{"id":15650433,"url":"https://github.com/technote-space/package-version-check-action","last_synced_at":"2025-08-09T16:24:27.202Z","repository":{"id":37701257,"uuid":"210013837","full_name":"technote-space/package-version-check-action","owner":"technote-space","description":"GitHub Actions to check package version before publish","archived":false,"fork":false,"pushed_at":"2023-12-30T03:06:11.000Z","size":9800,"stargazers_count":37,"open_issues_count":3,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-14T22:02:18.812Z","etag":null,"topics":["github-actions"],"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/technote-space.png","metadata":{"files":{"readme":"README.ja.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null},"funding":{"custom":"https://paypal.me/technote0space"}},"created_at":"2019-09-21T16:01:39.000Z","updated_at":"2024-11-27T19:51:56.000Z","dependencies_parsed_at":"2023-12-30T04:19:28.700Z","dependency_job_id":"fd209d61-6dc3-45d8-919f-ce38bd304876","html_url":"https://github.com/technote-space/package-version-check-action","commit_stats":{"total_commits":686,"total_committers":4,"mean_commits":171.5,"dds":0.467930029154519,"last_synced_commit":"ac7b8437799896a82947bbeecb35582ec962302e"},"previous_names":[],"tags_count":260,"template":false,"template_full_name":"technote-space/gh-actions-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/technote-space%2Fpackage-version-check-action","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/technote-space%2Fpackage-version-check-action/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/technote-space%2Fpackage-version-check-action/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/technote-space%2Fpackage-version-check-action/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/technote-space","download_url":"https://codeload.github.com/technote-space/package-version-check-action/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250887480,"owners_count":21503031,"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":["github-actions"],"created_at":"2024-10-03T12:34:37.115Z","updated_at":"2025-04-28T16:23:34.407Z","avatar_url":"https://github.com/technote-space.png","language":"TypeScript","funding_links":["https://paypal.me/technote0space"],"categories":[],"sub_categories":[],"readme":"# Package Version Check Action\n\n[![CI Status](https://github.com/technote-space/package-version-check-action/workflows/CI/badge.svg)](https://github.com/technote-space/package-version-check-action/actions)\n[![codecov](https://codecov.io/gh/technote-space/package-version-check-action/branch/master/graph/badge.svg)](https://codecov.io/gh/technote-space/package-version-check-action)\n[![CodeFactor](https://www.codefactor.io/repository/github/technote-space/package-version-check-action/badge)](https://www.codefactor.io/repository/github/technote-space/package-version-check-action)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/technote-space/package-version-check-action/blob/master/LICENSE)\n\n*Read this in other languages: [English](README.md), [日本語](README.ja.md).*\n\nnpmパッケージ公開前にパッケージのバージョンをチェックする`GitHub Actions`です。\n\n## Table of Contents\n\n\u003c!-- START doctoc generated TOC please keep comment here to allow auto update --\u003e\n\u003c!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --\u003e\n\u003cdetails\u003e\n\u003csummary\u003eDetails\u003c/summary\u003e\n\n- [スクリーンショット](#%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%BC%E3%83%B3%E3%82%B7%E3%83%A7%E3%83%83%E3%83%88)\n- [使用方法](#%E4%BD%BF%E7%94%A8%E6%96%B9%E6%B3%95)\n  - [プッシュ時に使用](#%E3%83%97%E3%83%83%E3%82%B7%E3%83%A5%E6%99%82%E3%81%AB%E4%BD%BF%E7%94%A8)\n  - [リリースプロセスで使用](#%E3%83%AA%E3%83%AA%E3%83%BC%E3%82%B9%E3%83%97%E3%83%AD%E3%82%BB%E3%82%B9%E3%81%A7%E4%BD%BF%E7%94%A8)\n- [オプション](#%E3%82%AA%E3%83%97%E3%82%B7%E3%83%A7%E3%83%B3)\n  - [BRANCH_PREFIX](#branch_prefix)\n  - [COMMIT_DISABLED](#commit_disabled)\n  - [COMMIT_MESSAGE](#commit_message)\n  - [PACKAGE_NAME](#package_name)\n  - [PACKAGE_DIR](#package_dir)\n  - [TEST_TAG_PREFIX](#test_tag_prefix)\n  - [NEXT_VERSION](#next_version)\n- [Action イベント詳細](#action-%E3%82%A4%E3%83%99%E3%83%B3%E3%83%88%E8%A9%B3%E7%B4%B0)\n  - [対象イベント](#%E5%AF%BE%E8%B1%A1%E3%82%A4%E3%83%99%E3%83%B3%E3%83%88)\n  - [Conditions](#conditions)\n- [動機](#%E5%8B%95%E6%A9%9F)\n- [補足](#%E8%A3%9C%E8%B6%B3)\n  - [コミット](#%E3%82%B3%E3%83%9F%E3%83%83%E3%83%88)\n  - [Tags](#tags)\n- [このアクションを使用しているリポジトリの例](#%E3%81%93%E3%81%AE%E3%82%A2%E3%82%AF%E3%82%B7%E3%83%A7%E3%83%B3%E3%82%92%E4%BD%BF%E7%94%A8%E3%81%97%E3%81%A6%E3%81%84%E3%82%8B%E3%83%AA%E3%83%9D%E3%82%B8%E3%83%88%E3%83%AA%E3%81%AE%E4%BE%8B)\n- [Author](#author)\n\n\u003c/details\u003e\n\u003c!-- END doctoc generated TOC please keep comment here to allow auto update --\u003e\n\n## スクリーンショット\n1. `GitHub Action` 実行中  \n\n   ![Running](https://raw.githubusercontent.com/technote-space/package-version-check-action/images/screenshot-1.png)\n\n1. package.json のバージョンを更新 (ブランチが保護されていない場合)\n  \n   ![Updated](https://raw.githubusercontent.com/technote-space/package-version-check-action/images/screenshot-2.png)\n\n## 使用方法\n### プッシュ時に使用\n   例：`.github/workflows/check_version.yml`\n   ```yaml\n   on: push\n   name: Check package version\n   jobs:\n     checkVersion:\n       name: Check package version\n       runs-on: ubuntu-latest\n       steps:\n         - uses: actions/checkout@v2\n\n         # Use this GitHub Action\n         - name: Check package version\n           uses: technote-space/package-version-check-action@v1\n           with:\n             BRANCH_PREFIX: release/\n   ```\n\n### リリースプロセスで使用\n   例：`.github/workflows/release.yml`\n   ```yaml\n   on:\n     push:\n       tags:\n         - 'v*'\n   name: Publish Package\n   jobs:\n     release:\n       name: Publish Package\n       runs-on: ubuntu-latest\n       steps:\n         - name: Checkout\n           uses: actions/checkout@v2\n\n         # Use this GitHub Action\n         - name: Check package version\n           uses: technote-space/package-version-check-action@v1\n           with:\n             COMMIT_DISABLED: 1\n\n         - name: Install Package dependencies\n           run: yarn install\n         - name: Build\n           run: yarn build\n         - name: Publish\n           run: |\n             npm config set //registry.npmjs.org/:_authToken=$NPM_AUTH_TOKEN\n             npm publish\n           env:\n             NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}\n   ```\n[対象イベントの詳細](#action-%E3%82%A4%E3%83%99%E3%83%B3%E3%83%88%E8%A9%B3%E7%B4%B0)\n\n## オプション\n### BRANCH_PREFIX\nブランチプリフィックス  \ndefault: `''`  \n例：`release/`\n\n### COMMIT_DISABLED\nコミットが無効かどうか  \ndefault: `''`\n\n### COMMIT_MESSAGE\nパッケージバージョン更新用コミットのメッセージ  \ndefault: `'feat: update package version'`\n\n### PACKAGE_NAME\nパッケージファイル名  \ndefault: `'package.json'`\n\n### PACKAGE_DIR\nパッケージファイルが置かれたディレクトリ  \ndefault: `''`\n\n### TEST_TAG_PREFIX\nテスト用タグのプリフィックス  \ndefault: `''`  \n例：`'test/'`\n\n### NEXT_VERSION\n次のバージョンを指定  \ndefault: `''`  \ne.g. `'v1.2.3'`\n\n## Action イベント詳細\n### 対象イベント\n| eventName: action | condition |\n|:---:|:---:|\n|push: *|[condition1](#condition1)|\n|release: published|[condition1](#condition1)|\n|pull_request, pull_request_target: opened, reopened, synchronize|[condition2](#condition2)|\n|created: *|[condition3](#condition3)|\n\n### Conditions\n#### condition1\n- tags\n  - semantic versioning tag (例：`v1.2.3`)\n- branches\n  - `${BRANCH_PREFIX}${tag}`\n    - tag: semantic versioning tag (例：`v1.2.3`)\n    - 例：branch: `release/v1.2.3`\n#### condition2\n- branches\n  - `${BRANCH_PREFIX}${tag}`\n    - tag: semantic versioning tag (例：`v1.2.3`)\n    - 例：branch: `release/v1.2.3`\n#### condition3\n- tags\n  - semantic versioning tag (例：`v1.2.3`)\n\n## 動機\npackage.jsonバージョンの更新を忘れると、npmパッケージの公開は失敗します。\n\n![Failed](https://raw.githubusercontent.com/technote-space/package-version-check-action/images/screenshot-4.png)\n\nタグのプッシュでアクションを起動していた場合、\n\n1. プッシュしたタグを削除\n1. package.json のバージョンを更新\n1. コミットして再度タグを付与\n1. プッシュ\n\nを再度行う必要があり、非常に面倒です。\n\nこの `GitHub Action` は、タグ名に基づいてpackage.jsonのバージョンを自動的に更新します。  \nしたがって、package.json のバージョンについて心配する必要はありません。  \n\nまた、ブランチが保護されていない場合、このアクションは変更をコミットします。  \nブランチが保護されている場合、このアクションは package.json のバージョンを更新するだけです。\n\n## 補足\n### コミット\nコミットは『タグ付きのデフォルトブランチ(通常はmaster)』または『`${BRANCH_PREFIX}`から始まるブランチ』へのプッシュ時のみ有効です。\n\nGitHub Actions で提供される`GITHUB_TOKEN`は連続するイベントを作成する権限がありません。  \nしたがって、プッシュによってトリガーされるビルドアクションなどは実行されません。  \n\n![GITHUB_TOKEN](https://raw.githubusercontent.com/technote-space/package-version-check-action/images/no_access_token.png)\n\nこれはブランチプロテクションを設定していると問題になる場合があります。  \n\nもしアクションをトリガーしたい場合は代わりに`personal access token`を使用してください。  \n1. public_repo または repo の権限で [Personal access token](https://docs.github.com/ja/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token) を生成  \n(repo はプライベートリポジトリで必要です)  \n1. [ACCESS_TOKENとして保存](https://docs.github.com/ja/actions/security-guides/encrypted-secrets)\n1. `GITHUB_TOKEN`の代わりに`ACCESS_TOKEN`を使用するように設定  \n   例：`.github/workflows/check_version.yml`\n   ```yaml\n   on: push\n   name: Check package version\n   jobs:\n     checkVersion:\n       name: Check package version\n       runs-on: ubuntu-latest\n       steps:\n         - uses: actions/checkout@v2\n\n         # Use this GitHub Action\n         - name: Check package version\n           uses: technote-space/package-version-check-action@v1\n           with:\n             GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}\n             BRANCH_PREFIX: release/\n   ```\n\n![ACCESS_TOKEN](https://raw.githubusercontent.com/technote-space/package-version-check-action/images/with_access_token.png)\n\n### Tags\nタグ名は [Semantic Versioning](https://semver.org/) に従っている必要があります。  \n\n## このアクションを使用しているリポジトリの例\n- [GitHub Action Helper](https://github.com/technote-space/github-action-helper)\n  - [pr-updated.yml](https://github.com/technote-space/github-action-helper/blob/master/.github/workflows/pr-updated.yml)\n  - [ci.yml](https://github.com/technote-space/github-action-helper/blob/master/.github/workflows/ci.yml)\n- [GitHub Action Config Helper](https://github.com/technote-space/github-action-config-helper)\n  - [pr-updated.yml](https://github.com/technote-space/github-action-config-helper/blob/master/.github/workflows/pr-updated.yml)\n  - [ci.yml](https://github.com/technote-space/github-action-config-helper/blob/master/.github/workflows/ci.yml)\n- [GitHub Action Test Helper](https://github.com/technote-space/github-action-test-helper)\n  - [pr-updated.yml](https://github.com/technote-space/github-action-test-helper/blob/master/.github/workflows/pr-updated.yml)\n  - [ci.yml](https://github.com/technote-space/github-action-test-helper/blob/master/.github/workflows/ci.yml)\n- [Filter GitHub Action](https://github.com/technote-space/filter-github-action)\n  - [pr-updated.yml](https://github.com/technote-space/filter-github-action/blob/master/.github/workflows/pr-updated.yml)\n  - [ci.yml](https://github.com/technote-space/filter-github-action/blob/master/.github/workflows/ci.yml)\n- [jQuery Marker Animation](https://github.com/technote-space/jquery.marker-animation)\n  - [pr-updated.yml](https://github.com/technote-space/jquery.marker-animation/blob/master/.github/workflows/pr-updated.yml)\n  - [ci.yml](https://github.com/technote-space/jquery.marker-animation/blob/master/.github/workflows/ci.yml)\n- [Gutenberg Utils](https://github.com/technote-space/gutenberg-utils)\n  - [pr-updated.yml](https://github.com/technote-space/gutenberg-utils/blob/master/.github/workflows/pr-updated.yml)\n  - [ci.yml](https://github.com/technote-space/gutenberg-utils/blob/master/.github/workflows/ci.yml)\n- [Register Grouped Format Type](https://github.com/technote-space/register-grouped-format-type)\n  - [pr-updated.yml](https://github.com/technote-space/register-grouped-format-type/blob/master/.github/workflows/pr-updated.yml)\n  - [ci.yml](https://github.com/technote-space/register-grouped-format-type/blob/master/.github/workflows/ci.yml)\n\n## Author\n[GitHub (Technote)](https://github.com/technote-space)  \n[Blog](https://technote.space)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftechnote-space%2Fpackage-version-check-action","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftechnote-space%2Fpackage-version-check-action","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftechnote-space%2Fpackage-version-check-action/lists"}