Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions .github/workflows/trigger-cli-update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Mirrors temporalio/api's "Trigger api-go Update" workflow, retargeted at the CLI:
# on every merge to api-go's main, dispatches the CLI's
# update-system-nexus-operations.yml, which bumps go.temporal.io/api, runs
# `make gen`, and opens a PR if the system Nexus operations changed.

name: 'Trigger CLI Update'

on:
push:
branches:
- main
workflow_dispatch:
inputs:
branch:
description: "Branch in CLI repo to trigger system Nexus update (default: main)"
required: true
default: main

jobs:
notify:
name: 'Trigger CLI Update'
runs-on: ubuntu-latest

defaults:
run:
shell: bash

steps:
- name: Generate token
id: generate_token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.TEMPORAL_CICD_APP_ID }}
private-key: ${{ secrets.TEMPORAL_CICD_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
repositories: cli # generate a token with permissions to trigger GHA in cli repo

- name: Dispatch CLI GitHub Action
env:
GH_TOKEN: ${{ steps.generate_token.outputs.token }}
EVENT_PUSH_BRANCH: ${{ github.event.ref }}
EVENT_PUSH_COMMIT_AUTHOR: ${{ github.event.head_commit.author.name }}
EVENT_PUSH_COMMIT_AUTHOR_EMAIL: ${{ github.event.head_commit.author.email }}
EVENT_PUSH_COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
EVENT_WF_DISPATCH_BRANCH: ${{ github.event.inputs.branch }}
run: |
case "${{ github.event_name }}" in
"push")
BRANCH="${EVENT_PUSH_BRANCH#refs/heads/}"
COMMIT_AUTHOR="${EVENT_PUSH_COMMIT_AUTHOR}"
COMMIT_AUTHOR_EMAIL="${EVENT_PUSH_COMMIT_AUTHOR_EMAIL}"
COMMIT_MESSAGE="${EVENT_PUSH_COMMIT_MESSAGE}"
;;

"workflow_dispatch")
BRANCH="${EVENT_WF_DISPATCH_BRANCH}"
COMMIT_AUTHOR="Temporal Data"
COMMIT_AUTHOR_EMAIL="commander-data@temporal.io"
COMMIT_MESSAGE="Update System Nexus Operations"
;;
esac

# The CLI receiver always bases the bump on its own main, so target main there
# regardless of the api-go branch name.
gh workflow run update-system-nexus-operations.yml -R https://github.com/temporalio/cli \
-r main \
-f branch=main \
-f commit_author="${COMMIT_AUTHOR}" \
-f commit_author_email="${COMMIT_AUTHOR_EMAIL}" \
-f commit_message="${COMMIT_MESSAGE}"
Comment on lines +21 to +70

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Semgrep identified an issue in your code:
No explicit GITHUB_TOKEN permissions found at the workflow or job level. Add a permissions: block at the workflow root (applies to all jobs) or per job with least privilege (e.g., contents: read and only specific writes like pull-requests: write if needed).

To resolve this comment:

🔧 No guidance has been designated for this issue. Fix according to your organization's approved methods.

💬 Ignore this finding

Reply with Semgrep commands to ignore this finding.

  • /fp <comment> for false positive
  • /ar <comment> for acceptable risk
  • /other <comment> for all other reasons

Alternatively, triage in Semgrep AppSec Platform to ignore the finding created by missing-explicit-permissions.

You can view more details about this finding in the Semgrep AppSec Platform.

Loading