Ensure context is inherited in validation

This commit is contained in:
Josh Gross
2022-12-08 13:55:46 -05:00
parent 7e5c8d20ae
commit f2c04b7b89
3 changed files with 10 additions and 7 deletions
@@ -1,11 +1,11 @@
import {TemplateToken} from "@github/actions-workflow-parser/templates/tokens/template-token";
export function getAllowedContext(token: TemplateToken, parent: TemplateToken): string[] {
export function getAllowedContext(token: TemplateToken, parent: TemplateToken | null | undefined): string[] {
// Workaround for https://github.com/github/c2c-actions-experience/issues/6876
// Context is inherited from the parent
const allowedContext = new Set<string>();
for (const t of [token, parent]) {
if (t.definition?.readerContext) {
if (t?.definition?.readerContext) {
for (const context of t.definition.readerContext) {
allowedContext.add(context);
}