github / github/docs

Inconsistent allowed contexts for reusable workflow secrets/inputs

Đang mở
#40,391 7 bình luận 0 reaction 0 người được giao Xem trên GitHub
content github_actions never-stale
Ngôn ngữ chính
TypeScript
Star
20.8k
Fork
68.7k
Merge trung bình
12 giờ 24 phút
Pull request đã merge (30 ngày)
105

Mô tả

### Code of Conduct

- [x] I have read and agree to the GitHub Docs project's [Code of Conduct](https://github.com/github/docs/blob/main/.github/CODE_OF_CONDUCT.md)

### What article on docs.github.com is affected?

- https://docs.github.com/en/actions/reference/workflows-and-actions/contexts
- https://docs.github.com/en/actions/reference/workflows-and-actions/reusable-workflows

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

I have found inconsistencies between the `actions/reference/workflows-and-actions/contexts.md` and the `actions/reference/workflows-and-actions/reusable-workflows.md` pages.

The `reusable-workflows.md` page defines contexts for `jobs..secrets.` and `jobs..with.` like so:

```markdown
## `jobs..with.`

[...]

Allowed expression contexts: `github`, and `needs`.
```

```markdown
## `jobs..secrets.`

[...]

Allowed expression contexts: `github`, `needs`, and `secrets`.
```

~~This seems to match observed behavior that the following using `vars`, using a reusable workflow that requires a secret, does not work:~~ _After testing in a different and cleaner environment,_ this actually does not match the observed behavior, as the following using `vars`, using a reusable workflow that requires a secret, does work:

```yml
jobs:
job:
uses: job.yml
secrets:
MY_SECRET: ${{ vars.MY_SECRET }}
```

Indeed, the `contexts.md` page defines these contexts like so:

```markdown
| `jobs..secrets.` | `github, needs, strategy, matrix, secrets, inputs, vars` | None |
| `jobs..with.` | `github, needs, strategy, matrix, inputs, vars` | None |
```

~~So I would have expected `vars` to work in this context, but it does not.~~

Also while we are at it, note the workflow keys are not consistent: `secrets_id` vs `secret_id`, and `with_id` vs `input_id`.

Therefore I would suggest to:
- Rename the workflow keys in the `contexts.md` page to match those in the `reusable-workflows.md` page,
- Update the "allowed expression contexts" in the `reusable-workflows.md` page to match what is described in the `contexts.md` page.

### Additional information

_No response_

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.