github / github/vscode-github-actions

Supporting `actions/github-script` step named outputs

オープン
#188 コメント 2 件 リアクション 8 件 担当者 0 名 GitHub で見る
enhancement
主要言語
TypeScript
スター
660
フォーク
213
PR マージ指標
30日以内にマージされた PR はありません

説明

**Is your feature request related to a problem? Please describe.**

When using https://github.com/actions/github-script with a call to `core.setOutput()`, the VSCode extension is unable to do autocompletion and shows "Context access might be invalid" warnings.

The usual way of setting outputs with `actions/github-script` is to use a `return` statement, which creates a `result` output, accessible with `steps..outputs.result` (https://github.com/actions/github-script#reading-step-results).

But we preferred to use the reference to the `core` API to set **named outputs** instead.

**Example:**
```yaml
- uses: actions/github-script@v6
id: get-versions
with:
script: |
const currentVersion = 'v1.0.0'
const nextVersion = 'v1.1.0'

core.setOutput('CURRENT_VERSION', currentVersion)
core.setOutput('NEXT_VERSION', nextVersion)
- name: Use versions
run: |
echo "Current version: ${{ steps.get-version.outputs.CURRENT_VERSION }}"
echo "Next version: ${{ steps.get-version.outputs.NEXT_VERSION }}"
```

**Describe the solution you'd like**

The VSCode extension should be able to read the inline scripts passed to your official `actions/github-script` action, and detect all the calls to `core.setOutput()` to provide autocompletion.

And realistically, I can understand that https://github.com/actions/github-script#run-a-separate-file would be a limitation. Trying to find all `require` statements, reading those files recursively, etc. would be too much for this VSCode extension. Or you would have to include some kind of bundling to find all the `core.setOutput()` in the import tree.

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

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

調査の方向性

ソースファイルもテストも指定されていません。まず、VS Code extension における GitHub Actions のコンテキストとインラインスクリプトの処理箇所を特定し、現在どのように step outputs を検出しているかを追跡してください。完了条件は、actions/github-script の core.setOutput() へのインライン呼び出しで output completion が提供され、記載されたコンテキスト警告が発生しなくなることです。別ファイルのスクリプトは引き続き対象外です。

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

評価

技術スタック
javascript, typescript, vscode
領域
developer-experience, devtools
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

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

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