|
1 | 1 | import type { GitHubWorkflows } from "./workflow"; |
2 | 2 |
|
| 3 | +/** |
| 4 | + * Root resources for a .github directory structure including workflows. |
| 5 | + * Represents the complete .github directory with all workflows and other resources. |
| 6 | + */ |
3 | 7 | export type DotGitHubRootResources = DotGitHubResources & { workflows: GitHubWorkflows }; |
| 8 | + |
| 9 | +/** |
| 10 | + * Collection of resources in a .github directory. |
| 11 | + * Maps resource names to their configurations. |
| 12 | + */ |
4 | 13 | export type DotGitHubResources = Record<string, DotGitHubResource>; |
5 | 14 |
|
| 15 | +/** |
| 16 | + * Represents a resource in the .github directory structure. |
| 17 | + * Can be either a file with content or a directory with child resources. |
| 18 | + */ |
6 | 19 | export type DotGitHubResource = { |
7 | | - /* File content, if a file */ |
| 20 | + /** File content, if this resource is a file */ |
8 | 21 | content?: unknown; |
9 | | - /* Child resources, if a directory */ |
| 22 | + /** Child resources, if this resource is a directory */ |
10 | 23 | children?: DotGitHubResources; |
11 | 24 | } |
12 | 25 |
|
| 26 | +/** |
| 27 | + * Complete representation of a .github directory structure. |
| 28 | + * Includes all workflows and other GitHub configuration resources. |
| 29 | + */ |
13 | 30 | export type DotGitHub = DotGitHubRootResources; |
14 | 31 |
|
| 32 | +/** |
| 33 | + * Possible values for GitHub Action inputs. |
| 34 | + * Actions can accept string, boolean, or numeric input values. |
| 35 | + */ |
15 | 36 | export type GitHubActionInputValue = string | boolean | number; |
16 | 37 |
|
| 38 | +/** |
| 39 | + * Configuration for a GitHub Action input parameter. |
| 40 | + * Defines how users can provide data to the action. |
| 41 | + */ |
17 | 42 | export type GitHubActionInput ={ |
| 43 | + /** Description of what this input does */ |
18 | 44 | description?: string; |
| 45 | + /** Whether this input is required for the action to run */ |
19 | 46 | required?: boolean | string; |
| 47 | + /** Default value if not provided by the user */ |
20 | 48 | default?: string | number | boolean; |
21 | 49 | } |
22 | 50 |
|
23 | | - |
| 51 | +/** |
| 52 | + * Configuration for a GitHub Action output. |
| 53 | + * Defines data that the action makes available to subsequent steps. |
| 54 | + */ |
24 | 55 | export type GitHubActionOutput = { |
| 56 | + /** Description of what this output contains */ |
25 | 57 | description?: string; |
26 | 58 | } |
27 | 59 |
|
28 | 60 |
|
| 61 | +/** |
| 62 | + * Complete metadata for a GitHub Action as defined in action.yml. |
| 63 | + * Contains all information needed to describe and run the action. |
| 64 | + */ |
29 | 65 | export type GitHubActionYml = { |
| 66 | + /** Name of the action displayed in the GitHub Marketplace */ |
30 | 67 | name?: string; |
| 68 | + /** Detailed description of what the action does */ |
31 | 69 | description?: string; |
| 70 | + /** Author or organization that created the action */ |
32 | 71 | author?: string; |
| 72 | + /** Branding information for the GitHub Marketplace */ |
33 | 73 | branding?: { |
| 74 | + /** Color theme for the action's icon */ |
34 | 75 | color?: string; |
| 76 | + /** Icon identifier from GitHub's icon set */ |
35 | 77 | icon?: string; |
36 | 78 | }; |
| 79 | + /** Input parameters that users can provide */ |
37 | 80 | inputs?: GitHubActionInputs; |
| 81 | + /** Output values that the action produces */ |
38 | 82 | outputs?: GitHubActionOutputs; |
| 83 | + /** Runtime configuration for how the action executes */ |
39 | 84 | runs?: GitHubActionRuns; |
40 | 85 | } |
41 | 86 |
|
42 | 87 |
|
| 88 | +/** |
| 89 | + * Runtime configuration for a GitHub Action. |
| 90 | + * Defines how the action should be executed when called. |
| 91 | + */ |
43 | 92 | export type GitHubActionRuns = { |
| 93 | + /** Runtime environment (docker, node12, composite, etc.) */ |
44 | 94 | using: string; |
| 95 | + /** Main entry point file for the action */ |
45 | 96 | main?: string; |
| 97 | + /** Pre-execution setup script */ |
46 | 98 | pre?: string; |
| 99 | + /** Post-execution cleanup script */ |
47 | 100 | post?: string; |
| 101 | + /** Docker image to use for containerized actions */ |
48 | 102 | image?: string; |
| 103 | + /** Command line arguments for the action */ |
49 | 104 | args?: string[]; |
| 105 | + /** Steps for composite actions */ |
50 | 106 | steps?: unknown[]; |
| 107 | + /** Environment variables for the action runtime */ |
51 | 108 | env?: EnvVars; |
52 | 109 | }; |
53 | 110 |
|
54 | 111 |
|
| 112 | +/** |
| 113 | + * Collection of input parameters for a GitHub Action. |
| 114 | + * Maps input names to their configurations. |
| 115 | + */ |
55 | 116 | export type GitHubActionInputs = Record<string, GitHubActionInput>; |
| 117 | + |
| 118 | +/** |
| 119 | + * Collection of output values for a GitHub Action. |
| 120 | + * Maps output names to their configurations. |
| 121 | + */ |
56 | 122 | export type GitHubActionOutputs = Record<string, GitHubActionOutput>; |
| 123 | + |
| 124 | +/** |
| 125 | + * Environment variables configuration. |
| 126 | + * Maps environment variable names to their string values. |
| 127 | + */ |
57 | 128 | export type EnvVars = Record<string, string>; |
0 commit comments