| description | CodeQL AST node reference for GitHub Actions |
|---|
Based on analysis of CodeQL's Actions AST test results from local test files, here are the core AST classes for GitHub Actions analysis:
Action Files (action.yml):
CompositeActionImpl- Root composite action declaration (e.g.,name: "Hello World")- Action metadata including name, description, and runtime configuration
Workflow Files (.github/workflows/*.yml):
WorkflowImpl- Root workflow declaration (e.g.,name: Reusable workflow example)- Complete workflow structure with events, jobs, and steps
Event Triggers:
OnImpl- Event trigger definitions (e.g.,workflow_call:)EventImpl- Specific event types (e.g.,workflow_call)- Event configuration with inputs, outputs, and secrets
Input Structures:
InputsImpl- Input containers for actions and workflowsInputImpl- Individual input definitions (e.g.,who-to-greet,config-path)- Input properties: description, required, type, default values
Output Structures:
OutputsImpl- Output containers for workflows and jobs- Output value expressions and job output references
Job Structure:
JobImpl- Job definitions (e.g.,Job: job1)- Job configuration including runner, outputs, and steps
- Job-level environment and dependency management
Job Execution Environment:
- Runner specifications (e.g.,
ubuntu-latest) - Job outputs and step output references
Step Types:
StepImpl- Generic step containersRun Step- Steps with shell commands and scriptsUses Step- Steps using external actions
Step Components:
- Step identification and naming
- Shell command execution
- External action usage (e.g.,
tj-actions/changed-files@v40)
Environment Variables:
EnvImpl- Environment variable definitions- Environment variable scoping (step-level, job-level)
- Variable interpolation and expression evaluation
Expression Handling:
ExpressionImpl- GitHub Actions expressions (e.g.,inputs.who-to-greet,jobs.job1.outputs.job-output1)- Expression contexts: inputs, steps, jobs, github, env
- Complex expression evaluation and context access
Expression Contexts:
- Input references:
inputs.config-path,inputs.who-to-greet - Step output references:
steps.step1.outputs.step-output,steps.step2.outputs.all_changed_files - Job output references:
jobs.job1.outputs.job-output1
Scalar Values:
ScalarValueImpl- String literals, booleans, and scalar data- Configuration values (e.g.,
"Hello World","composite",true) - Command strings and action references
Value Types:
- String values for names, descriptions, commands
- Boolean values for required flags and conditions
- Action references and version specifications
Composite Actions:
using: "composite"runtime specification- Step sequence execution within composite actions
- Input parameter passing and environment setup
Action Metadata:
- Action names and descriptions
- Input/output specifications
- Runtime environment configuration
Command Execution:
- Shell command strings (e.g.,
echo "Hello $INPUT_WHO_TO_GREET.") - Shell specification (e.g.,
bash) - Multi-line command support
Environment Integration:
- Environment variable usage in commands
- Variable substitution and expansion
- Input-to-environment variable mapping
Action Usage:
- External action references (e.g.,
tj-actions/changed-files@v40) - Version pinning and action marketplace integration
- Action parameter passing and configuration
Reusable Workflows:
- Workflow call triggers and parameters
- Input/output parameter definitions
- Secret management and passing
Workflow Composition:
- Job dependencies and sequencing
- Output propagation between jobs
- Workflow-level input and output management
Secret Management:
- Secret declarations and requirements
- Secret passing in reusable workflows
- Secure environment variable handling
Based on CodeQL's GitHub Actions analysis capabilities:
WorkflowImpl (root workflow)
├── OnImpl (event triggers)
│ └── EventImpl (specific events like workflow_call)
├── InputsImpl (workflow inputs)
│ └── InputImpl (individual inputs)
├── OutputsImpl (workflow outputs)
├── JobImpl (job definitions)
│ ├── OutputsImpl (job outputs)
│ └── StepImpl (job steps)
│ ├── EnvImpl (step environment)
│ └── ScalarValueImpl (step commands/actions)
└── ScalarValueImpl (scalar values throughout)
CompositeActionImpl (root action)
├── InputsImpl (action inputs)
├── RunsImpl (execution configuration)
└── StepImpl (action steps)
├── EnvImpl (step environment)
└── ScalarValueImpl (commands and values)
ExpressionImpl (expressions like ${{ inputs.name }})
└── Context access (inputs, steps, jobs, github, env)
This repo contains a variant of the open-source PrintAst.ql query for actions language, with modifications for local testing: