Skip to content

gh aw validate rejects the valid typed / untyped issues activity types #52754

Description

@MattSkala

Summary

gh aw validate rejects the typed and untyped activity types of the issues event. GitHub supports them, and gh aw compile accepts them. Only validation fails.

Reproduction

Frontmatter:

on:
  issues:
    types: [opened, reopened, typed]

gh aw compile succeeds. gh aw validate fails:

error: invalid workflow: GitHub Actions schema validation failed:
jsonschema validation failed with 'https://json.schemastore.org/github-workflow.json#'
- at '/on': 'oneOf' failed, none matched
  - at '/on/issues/types/2': value must be one of 'opened', 'edited', 'deleted',
    'transferred', 'pinned', 'unpinned', 'closed', 'reopened', 'assigned',
    'unassigned', 'labeled', 'unlabeled', 'locked', 'unlocked', 'milestoned',
    'demilestoned'

The compiled lock file is correct, and GitHub runs the workflow as expected. strict: false does not change the result.

Cause

pkg/workflow/schemas/github-workflow.json comes from SchemaStore, whose list of issues activity types stops at demilestoned. GitHub documents four more:

typed, untyped, field_added, field_removed

ref: https://docs.github.com/en/actions/reference/workflows-and-actions/events-that-trigger-workflows#issues

typed and untyped came with Issue Types. They are the only way to start a workflow when a user sets or removes the type of an issue. This matters for triage workflows that act on one type: an issue that gets its type after creation never triggers on opened.

I confirmed the four values are absent from the vendored schema in v0.85.4, v0.86.2 and main. They are also absent from SchemaStore master, so a re-download does not fix it.

Suggested fix

The Makefile already has a target for keys that SchemaStore does not carry:

patch-github-actions-schema:
	@tmpfile=$$(mktemp) && \
		jq '.definitions["permissions-event"].properties += {"copilot-requests": ..., "vulnerability-alerts": ...}' \
			pkg/workflow/schemas/github-workflow.json > "$$tmpfile" && \
		mv "$$tmpfile" pkg/workflow/schemas/github-workflow.json

Please extend that same target to append the missing activity types to the issues block. Both the enum and the identical default list need the change.

Workaround

We removed the affected workflow from gh aw validate in CI. gh aw compile still covers it.

Upstream

I reported the root cause to SchemaStore: SchemaStore/schemastore#6211

A patch here would not need to wait for that to land, in the same way the permissions-event patch does not wait for SchemaStore/schemastore#6175.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions