Documentation bug: expression numbers are mis-documented

オープン 初心者向け
#43,008 コメント 11 件 リアクション 1 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
78/100
issue の種類
ドキュメント
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
github-actions, javascript
領域
documentation

調査の方向性

GitHub Actions の式構文ページにある「Literals」セクションから始め、Free、Pro、Teams、GHES、GHEC の各バージョンを比較してください。expressions/src/data/string.ts の 14–16 行目にある参照先の parser ソースと、リンク先の Number coercion rules を確認してください。すべての対象ページで、受け入れられる Number literals がドキュメントに正確に記載されていれば完了です。

索引モデルが issue の本文から書いたものです。

説明

builder persona content github_actions never-stale
Code of Conduct
What article on docs.github.com is affected?

The "Literals" section of the GitHub Actions expression syntax page:

https://docs.github.com/en/actions/reference/workflows-and-actions/expressions#literals

That link is for the "Free, Pro, and Teams" page, but the GHES and GHEC pages are also affected.

What part(s) of the article would you like to see updated?

The number literal is documented as "Any number format supported by JSON." However, in reality, the GitHub Actions expression parser takes a much larger set of literals, which it coerces to numbers.

For example, neither hex nor octal literals are valid in JSON, but GitHub Actions accepts them. For example:

${{ 0xff }}
${{ 0o777 }}

More generally, GitHub Actions appears to support any number literal that the JavaScript Number(...) constructor can coerce a string from. Those coercion rules are documented here:

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number#number_coercion

This can be seen in the official GitHub Actions expression parser, which appears to use the Number(...) constructor when turning a StringData lexeme into a number:

https://github.com/actions/languageservices/blob/fb5c6e4f27bb1ddf512609a6a341aadd17ce86f3/expressions/src/data/string.ts#L14-L16

Additional information

Yes, this is trivially reproducible in any GitHub Actions workflow or action definition.

See https://github.com/zizmorcore/zizmor/pull/1628 for a related downstream report.

主要言語
TypeScript
スター
20.9k
フォーク
68.8k
平均マージ
13時間 43分
マージ済み PR(30日)
110

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

github/docs のほかの issue

github/docs の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。