-
Notifications
You must be signed in to change notification settings - Fork 539
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1464 from kubernetes-client/mstruebing/port-gener…
…ate-javascript-action [release-1.x] ci: add generate javascript action
- Loading branch information
Showing
1 changed file
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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,53 @@ | ||
name: Generate | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
kubernetesBranch: | ||
type: string | ||
required: true | ||
description: 'The remote kubernetes release branch to fetch openapi spec. .e.g. "release-1.23"' | ||
genCommit: | ||
type: string | ||
required: true | ||
default: '7ac2e3d8c036a64e265a38220c91cee3ec557583' | ||
description: 'The commit to use for the kubernetes-client/gen repo' | ||
|
||
|
||
jobs: | ||
generate: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Javascript | ||
uses: actions/checkout@v4 | ||
- name: Setup Node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '18' | ||
- name: Generate Openapi | ||
run: | | ||
echo "export KUBERNETES_BRANCH=${{ github.event.inputs.kubernetesBranch }} >> ./settings" | ||
echo "export GEN_COMMIT="${{ github.event.inputs.genCommit }}" >> ./settings" | ||
./generate-client.sh | ||
- name: Generate Branch Name | ||
run: | | ||
SUFFIX=$(openssl rand -hex 4) | ||
echo "BRANCH=automated-generate-$SUFFIX" >> $GITHUB_ENV | ||
- name: Commit and push | ||
run: | | ||
# Commit and push | ||
git config user.email "[email protected]" | ||
git config user.name "Kubernetes Prow Robot" | ||
git checkout -b "$BRANCH" | ||
git add . | ||
# we modify the settings file in "Generate Openapi" but do not want to commit this | ||
git reset settings | ||
git commit -s -m 'Automated openapi generation from ${{ github.event.inputs.kubernetesBranch }}' | ||
git push origin "$BRANCH" | ||
- name: Pull Request | ||
uses: repo-sync/pull-request@v2 | ||
with: | ||
source_branch: ${{ env.BRANCH }} | ||
destination_branch: ${{ github.ref_name }} | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
pr_title: "Automated Generate from openapi ${{ github.event.inputs.kubernetesBranch }}" |