diff --git a/.github/workflows/release.lock.yml b/.github/workflows/release.lock.yml index e56ebc504c1..6ef13471229 100644 --- a/.github/workflows/release.lock.yml +++ b/.github/workflows/release.lock.yml @@ -1465,3 +1465,30 @@ jobs: path: /tmp/safe-output-items.jsonl if-no-files-found: warn + sync_actions: + needs: + - activation + - config + - pre_activation + - push_tag + runs-on: ubuntu-latest + environment: gh-aw-actions-release + steps: + - name: "Notify - run sync actions and merge PR" + run: | + echo "## Manual Sync Actions Required" >> "$GITHUB_STEP_SUMMARY" + echo "" >> "$GITHUB_STEP_SUMMARY" + echo "The following manual steps must be completed in **github/gh-aw-actions** before this release continues:" >> "$GITHUB_STEP_SUMMARY" + echo "" >> "$GITHUB_STEP_SUMMARY" + echo "1. Trigger the **sync-actions** workflow in github/gh-aw-actions:" >> "$GITHUB_STEP_SUMMARY" + echo " https://github.com/github/gh-aw-actions/actions/workflows/sync-actions.yml" >> "$GITHUB_STEP_SUMMARY" + echo "2. Merge the PR created by the sync-actions workflow in **github/gh-aw-actions**" >> "$GITHUB_STEP_SUMMARY" + echo "3. Verify that tag **\`${RELEASE_TAG}\`** exists in github/gh-aw-actions" >> "$GITHUB_STEP_SUMMARY" + echo "" >> "$GITHUB_STEP_SUMMARY" + echo "Once the above steps are complete, approve the **gh-aw-actions-release** environment gate to continue the release." >> "$GITHUB_STEP_SUMMARY" + + echo "Sync actions instructions written for release: $RELEASE_TAG" + echo "Ensure the sync-actions job has been run and the PR merged in github/gh-aw-actions before approving." + env: + RELEASE_TAG: ${{ needs.config.outputs.release_tag }} + diff --git a/.github/workflows/release.md b/.github/workflows/release.md index f284e7dfa79..e7389eb4bce 100644 --- a/.github/workflows/release.md +++ b/.github/workflows/release.md @@ -194,6 +194,29 @@ jobs: path: dist/ retention-days: 1 + sync_actions: + needs: ["pre_activation", "activation", "config", "push_tag"] + runs-on: ubuntu-latest + environment: gh-aw-actions-release + steps: + - name: Notify - run sync actions and merge PR + env: + RELEASE_TAG: ${{ needs.config.outputs.release_tag }} + run: | + echo "## Manual Sync Actions Required" >> "$GITHUB_STEP_SUMMARY" + echo "" >> "$GITHUB_STEP_SUMMARY" + echo "The following manual steps must be completed in **github/gh-aw-actions** before this release continues:" >> "$GITHUB_STEP_SUMMARY" + echo "" >> "$GITHUB_STEP_SUMMARY" + echo "1. Trigger the **sync-actions** workflow in github/gh-aw-actions:" >> "$GITHUB_STEP_SUMMARY" + echo " https://github.com/github/gh-aw-actions/actions/workflows/sync-actions.yml" >> "$GITHUB_STEP_SUMMARY" + echo "2. Merge the PR created by the sync-actions workflow in **github/gh-aw-actions**" >> "$GITHUB_STEP_SUMMARY" + echo "3. Verify that tag **\`${RELEASE_TAG}\`** exists in github/gh-aw-actions" >> "$GITHUB_STEP_SUMMARY" + echo "" >> "$GITHUB_STEP_SUMMARY" + echo "Once the above steps are complete, approve the **gh-aw-actions-release** environment gate to continue the release." >> "$GITHUB_STEP_SUMMARY" + + echo "Sync actions instructions written for release: $RELEASE_TAG" + echo "Ensure the sync-actions job has been run and the PR merged in github/gh-aw-actions before approving." + release: needs: ["pre_activation", "activation", "config"] runs-on: ubuntu-latest diff --git a/pkg/parser/schemas/main_workflow_schema.json b/pkg/parser/schemas/main_workflow_schema.json index af31aac6577..e605ffd59a4 100644 --- a/pkg/parser/schemas/main_workflow_schema.json +++ b/pkg/parser/schemas/main_workflow_schema.json @@ -1857,6 +1857,31 @@ "$ref": "#/properties/concurrency", "description": "Concurrency control configuration for this job. Prevents parallel execution of jobs with the same concurrency group." }, + "environment": { + "oneOf": [ + { + "type": "string", + "description": "The name of the GitHub Actions environment this job references. Environments can have protection rules (required reviewers, wait timers) that must be satisfied before the job runs." + }, + { + "type": "object", + "description": "Environment configuration with name and optional URL.", + "additionalProperties": false, + "properties": { + "name": { + "type": "string", + "description": "The name of the GitHub Actions environment." + }, + "url": { + "type": "string", + "description": "The URL to set as the environment URL in the deployment." + } + }, + "required": ["name"] + } + ], + "description": "The GitHub Actions environment this job references. When set, any protection rules for the environment must pass before the job runs. Use this to gate jobs on manual approval workflows." + }, "uses": { "type": "string", "description": "Path to a reusable workflow file to call (e.g., ./.github/workflows/reusable-workflow.yml)" diff --git a/pkg/workflow/compiler_jobs.go b/pkg/workflow/compiler_jobs.go index 75c1c66a852..b371d5d6fc6 100644 --- a/pkg/workflow/compiler_jobs.go +++ b/pkg/workflow/compiler_jobs.go @@ -632,6 +632,26 @@ func (c *Compiler) buildCustomJobs(data *WorkflowData, activationJobCreated bool } } + // Extract environment for custom jobs + if environment, hasEnvironment := configMap["environment"]; hasEnvironment { + switch v := environment.(type) { + case string: + job.Environment = "environment: " + v + case map[string]any: + yamlBytes, err := yaml.Marshal(v) + if err != nil { + return fmt.Errorf("failed to convert environment to YAML for job '%s': %w", jobName, err) + } + lines := strings.Split(strings.TrimSpace(string(yamlBytes)), "\n") + var formattedEnvironment strings.Builder + formattedEnvironment.WriteString("environment:\n") + for _, line := range lines { + formattedEnvironment.WriteString(" " + line + "\n") + } + job.Environment = strings.TrimSuffix(formattedEnvironment.String(), "\n") + } + } + // Extract outputs for custom jobs if outputs, hasOutputs := configMap["outputs"]; hasOutputs { if outputsMap, ok := outputs.(map[string]any); ok {