Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix missing GITHUB_TOKEN secret on workflow_call #106

Merged
merged 4 commits into from
Feb 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion expr_sema.go
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,15 @@ func (sema *ExprSemanticsChecker) UpdateNeeds(ty *ObjectType) {
// UpdateSecrets updates 'secrets' context object to given object type.
func (sema *ExprSemanticsChecker) UpdateSecrets(ty *ObjectType) {
sema.ensureVarsCopied()
sema.vars["secrets"] = ty

// Merges automatically supplied secrets with manually defined secrets.
copied := NewStrictObjectType(map[string]ExprType{
"github_token": StringType{},
})
for n, v := range ty.Props {
copied.Props[n] = v
}
sema.vars["secrets"] = copied
}

// UpdateInputs updates 'inputs' context object to given object type.
Expand Down
2 changes: 1 addition & 1 deletion testdata/err/workflow_call_secrets.out
Original file line number Diff line number Diff line change
@@ -1 +1 @@
test.yaml:14:23: property "secret1" is not defined in object type {secret0: string} [expression]
test.yaml:14:23: property "secret1" is not defined in object type {github_token: string; secret0: string} [expression]
2 changes: 1 addition & 1 deletion testdata/examples/workflow_inputs_secrets_types.out
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
/test\.yaml:20:23: property "uri" is not defined in object type {.+} \[expression\]/
test.yaml:23:22: property "credentials" is not defined in object type {credential: string} [expression]
test.yaml:23:22: property "credentials" is not defined in object type {github_token: string; credential: string} [expression]
23 changes: 23 additions & 0 deletions testdata/ok/issue-87.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Lint Code Base

on:
push:
workflow_call:

jobs:
build:
name: Lint Code Base
runs-on: ubuntu-latest

steps:
- name: Checkout Code
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Lint Code Base
uses: github/super-linter@v4
env:
VALIDATE_ALL_CODEBASE: false
DEFAULT_BRANCH: master
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}