-
Notifications
You must be signed in to change notification settings - Fork 47
feat: trigger CLI code generation on API changes #287
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
spkane31
wants to merge
1
commit into
main
Choose a base branch
from
spk/sne-codegen
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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}" | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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_TOKENpermissions found at the workflow or job level. Add apermissions:block at the workflow root (applies to all jobs) or per job with least privilege (e.g.,contents: readand only specific writes likepull-requests: writeif 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 reasonsAlternatively, 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.