Skip to content

Commit 7ede7a1

Browse files
authored
Add new allowed GitHub Actions context expressions for workflow runs (#57)
* Add new allowed GitHub Actions context expressions for workflow runs * Fix formatting in the long description of the root command
1 parent 0c1dee4 commit 7ede7a1

File tree

5 files changed

+25
-1
lines changed

5 files changed

+25
-1
lines changed

cmd/gh-aw/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func validateEngine(engine string) error {
2929
var rootCmd = &cobra.Command{
3030
Use: constants.CLIExtensionPrefix,
3131
Short: "GitHub Agentic Workflows CLI from GitHub Next",
32-
Long: ` = GitHub Agentic Workflows from GitHub Next
32+
Long: `GitHub Agentic Workflows from GitHub Next
3333
3434
A natural language GitHub Action is a markdown file checked into the .github/workflows directory of a repository.
3535
The file contains a natural language description of the workflow, which is then compiled into a GitHub Actions workflow file.

docs/workflow-structure.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,9 @@ The following GitHub Actions context expressions are permitted in workflow markd
135135
- `${{ github.event.workflow_run.conclusion }}` - The conclusion of the workflow run that triggered the current workflow
136136
- `${{ github.event.workflow_run.html_url }}` - The URL of the workflow run that triggered the current workflow
137137
- `${{ github.event.workflow_run.head_sha }}` - The head SHA of the workflow run that triggered the current workflow
138+
- `${{ github.event.workflow_run.run_number }}` - The run number of the workflow run that triggered the current workflow
139+
- `${{ github.event.workflow_run.event }}` - The event that triggered the workflow run that triggered the current workflow
140+
- `${{ github.event.workflow_run.status }}` - The status of the workflow run that triggered the current workflow
138141
- `${{ github.actor }}` - The username of the user who triggered the workflow
139142
- `${{ github.job }}` - Job ID of the current workflow run
140143
- `${{ github.owner }}` - The owner of the repository (user or organization name)

pkg/cli/templates/instructions.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,9 @@ Use GitHub Actions context expressions throughout the workflow content. **Note:
193193
- **`${{ github.event.workflow_run.conclusion }}`** - Conclusion of the workflow run
194194
- **`${{ github.event.workflow_run.html_url }}`** - URL of the workflow run
195195
- **`${{ github.event.workflow_run.head_sha }}`** - Head SHA of the workflow run
196+
- **`${{ github.event.workflow_run.run_number }}`** - Run number of the workflow run
197+
- **`${{ github.event.workflow_run.event }}`** - Event that triggered the workflow run
198+
- **`${{ github.event.workflow_run.status }}`** - Status of the workflow run
196199
- **`${{ github.actor }}`** - Username of the person who initiated the workflow
197200
- **`${{ github.job }}`** - Job ID of the current workflow run
198201
- **`${{ github.owner }}`** - Owner of the repository

pkg/constants/constants.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ var AllowedExpressions = []string{
3535
"github.event.workflow_run.conclusion",
3636
"github.event.workflow_run.html_url",
3737
"github.event.workflow_run.head_sha",
38+
"github.event.workflow_run.run_number",
39+
"github.event.workflow_run.event",
40+
"github.event.workflow_run.status",
3841
"github.actor",
3942
"github.job",
4043
"github.owner",

pkg/workflow/expression_safety_test.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,21 @@ func TestValidateExpressionSafety(t *testing.T) {
7272
content: "Head SHA: ${{ github.event.workflow_run.head_sha }}",
7373
expectError: false,
7474
},
75+
{
76+
name: "allowed_github_event_workflow_run_run_number",
77+
content: "Run number: ${{ github.event.workflow_run.run_number }}",
78+
expectError: false,
79+
},
80+
{
81+
name: "allowed_github_event_workflow_run_event",
82+
content: "Triggering event: ${{ github.event.workflow_run.event }}",
83+
expectError: false,
84+
},
85+
{
86+
name: "allowed_github_event_workflow_run_status",
87+
content: "Run status: ${{ github.event.workflow_run.status }}",
88+
expectError: false,
89+
},
7590
{
7691
name: "multiple_allowed_expressions",
7792
content: "Workflow: ${{ github.workflow }}, Repository: ${{ github.repository }}, Output: ${{ needs.task.outputs.text }}",

0 commit comments

Comments
 (0)