Skip to content

add github package publish workflow - #1146

Open
KosukeTakahashi0410 wants to merge 8 commits into
masterfrom
KosukeTakahashi0410/feat/change_publish_workflow_to_publish_to_github_packages
Open

add github package publish workflow#1146
KosukeTakahashi0410 wants to merge 8 commits into
masterfrom
KosukeTakahashi0410/feat/change_publish_workflow_to_publish_to_github_packages

Conversation

@KosukeTakahashi0410

@KosukeTakahashi0410 KosukeTakahashi0410 commented Jul 9, 2026

Copy link
Copy Markdown

Why

npmへのリリースに際して、現在はGranular access tokensを生成してPublishを行っている
しかしGranular access tokensは90日間でローテーションする、また、トークンの漏洩リスクは存在している
Github Packagesへの移行を行うことで一定上記の問題が解消できるため、Github Packagesへ移行を行う

What

  • publishのワークフローでgithub packagesへpublish、その後npmにpublishするように修正
  • packageの設定(name, publish config)を修正
  • yarn linkのためのスクリプトを追加

追加の修正

CI を green にするために以下を追加した。

改名で壊れた参照の修正

@wantedly/* への改名にリポジトリ内の相互参照が追従しておらず、build と lint が失敗していた。

  • .prettierrc / eslint.config.mjs / 各 config パッケージの base.js react.js / packages/frolint/src の参照を改名後の名前に更新した
  • 未リリースの changeset が旧名を指していたので更新した。そのままだと changesets がパッケージを解決できずリリースが失敗する
  • ESLint プラグインの meta.name を実際のパッケージ名に合わせ、スナップショットを更新した
  • DefaultCommand の ESLint config 解決ブロックを削除した。パス計算がスコープ無しの配置を前提にしており改名で壊れるうえ、module.paths へ push した値はその後に require が無いので読まれない

publish の修正

  • create-release-pr job に registry-urlscope を指定した setup-node を足した。これが無いと GitHub Packages 用の _authToken がどこにも書かれず publish が 401 になる。install より後に置いているのは、先に置くと public な依存の解決まで GitHub Packages に向いてしまうため
  • npm 向け job のスコープ剥がしを package.json だけでなくビルド成果物にも広げた。packages/frolint/lib/utils/prettier.js などがスコープ付きの名前で require しており、package.json の名前だけ戻すと npm 側のパッケージが壊れる
  • workflow の env を削除した。どちらの環境変数も参照されておらず、// は YAML のコメントではないので値にゴミが入っていた

lint job の修正

lint job だけ build を挟んでおらず、共有 ESLint config が読み込む eslint-plugin-wantedly の main(ビルド成果物)が存在しないため ESLint が起動できなかった。この PR の改名とは無関係の既存の問題で、lint 対象のファイルがある PR では必ず失敗する。

補足

changeset は追加していない。改名後のパッケージは GitHub Packages 上にまだ存在しないので、changeset publish が現行バージョンをそのまま publish する。利用側が名前を差し替えるときにバージョンを据え置けるので、そのほうが移行しやすい。

publish は master への merge 後にしか走らないため、この PR の CI では検証できない。

@github-actions github-actions Bot added the repo Root directory of this project label Jul 9, 2026
@github-actions github-actions Bot added frolint https://www.npmjs.com/package/frolint eslint-config-wantedly-typescript https://www.npmjs.com/package/eslint-config-wantedly-typescript eslint-config-wantedly https://www.npmjs.com/package/eslint-config-wantedly eslint-plugin-use-macros https://www.npmjs.com/package/eslint-plugin-use-macros eslint-plugin-wantedly https://www.npmjs.com/package/eslint-plugin-wantedly prettier-config-wantedly https://www.npmjs.com/package/prettier-config-wantedly labels Jul 9, 2026
KosukeTakahashi0410 and others added 5 commits July 9, 2026 17:27
Renaming the packages left every cross-package reference pointing at the old
unscoped names, which broke the build. Drop the ESLint config resolution block
in DefaultCommand as well: its path arithmetic assumed an unscoped layout, and
the module.paths it pushed were never read because no require follows it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The shared ESLint config loads eslint-plugin-wantedly, whose main entry is its
build output. The lint job never built, so ESLint failed to load whenever the
job had files to lint.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The rewrite now touches .js sources, so the temp commit tripped the pre-commit
hook: lint-staged runs ESLint against names that only exist on npm. Skip the
hook, fail the step if the rewrite matches nothing, and point the generated
pre-commit hook at the scoped install path so the npm rewrite restores it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

eslint-config-wantedly https://www.npmjs.com/package/eslint-config-wantedly eslint-config-wantedly-typescript https://www.npmjs.com/package/eslint-config-wantedly-typescript eslint-plugin-use-macros https://www.npmjs.com/package/eslint-plugin-use-macros eslint-plugin-wantedly https://www.npmjs.com/package/eslint-plugin-wantedly frolint https://www.npmjs.com/package/frolint prettier-config-wantedly https://www.npmjs.com/package/prettier-config-wantedly repo Root directory of this project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants