Skip to content

[Improve]: actions/github-script を v7.0.1 から v9.0.0 にアップデートする #630

Description

@YumNumm

背景

GitHub Actions で利用している actions/github-script を v7 系から v9 系へ更新する。

現在、workflow で actions/github-script v7.0.1 が利用されている。pinact run -u --min-age 7 の結果、更新先は v9.0.0 となる。

対象

  • actions/github-script v7.0.1 -> v9.0.0

参考

Changelog

actions/github-script v8

What's Changed

⚠️ Minimum Compatible Runner Version

v2.327.1
Release Notes

Make sure your runner is updated to this version or newer to use this release.

New Contributors

Full Changelog: actions/github-script@v7.1.0...v8.0.0

https://github.com/actions/github-script/releases/tag/v8 より引用

actions/github-script v9.0.0

New features:

  • getOctokit factory function — Available directly in the script context. Create additional authenticated Octokit clients with different tokens for multi-token workflows, GitHub App tokens, and cross-org access. See Creating additional clients with getOctokit for details and examples.
  • Orchestration ID in user-agent — The ACTIONS_ORCHESTRATION_ID environment variable is automatically appended to the user-agent string for request tracing.

Breaking changes:

  • require('@actions/github') no longer works in scripts. The upgrade to @actions/github v9 (ESM-only) means require('@actions/github') will fail at runtime. If you previously used patterns like const { getOctokit } = require('@actions/github') to create secondary clients, use the new injected getOctokit function instead — it's available directly in the script context with no imports needed.
  • getOctokit is now an injected function parameter. Scripts that declare const getOctokit = ... or let getOctokit = ... will get a SyntaxError because JavaScript does not allow const/let redeclaration of function parameters. Use the injected getOctokit directly, or use var getOctokit = ... if you need to redeclare it.
  • If your script accesses other @actions/github internals beyond the standard github/octokit client, you may need to update those references for v9 compatibility.

What's Changed

New Contributors

Full Changelog: actions/github-script@v8.0.0...v9.0.0

https://github.com/actions/github-script/releases/tag/v9.0.0 より引用

主な変更点

  • v8.0.0 で action runtime が Node.js 24 に更新された。
  • self-hosted runner を使う場合は Actions Runner v2.327.1 以上が必要。
  • @actions/github v9 が ESM-only になり、script 内の require('@actions/github') は利用できなくなる。
  • getOctokit が script context に注入される。
  • 現在の wc-changes.yml の script では require('@actions/github')getOctokit の再宣言は見つからない。

対応方針

  • actions/github-script を利用している workflow を v9.0.0 に更新する。
  • 対象 script の出力 dependencies が従来通り設定されることを確認する。

完了条件

  • pinact により actions/github-scriptv9.0.0 に更新されている。
  • pinact run --verify が成功する。
  • wc-changes.yml を呼び出す check workflow が PR 上で成功する。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions