-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add generating samples for any kind of object that supports ope…
…nAPIV3schema
- Loading branch information
Showing
27 changed files
with
2,006 additions
and
164 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,30 @@ | ||
name: Sync File from Repo B | ||
|
||
on: | ||
schedule: | ||
- cron: "0 0 * * *" # Runs daily at midnight | ||
workflow_dispatch: | ||
|
||
jobs: | ||
sync-file: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Kubernetes API server | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: kubernetes/apiextensions-apiserver | ||
path: apiextensions-apiserver | ||
- name: Checkout This Repository | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: ${{ github.repository }} | ||
path: this | ||
|
||
- name: Install GitHub CLI | ||
run: sudo apt-get install gh | ||
|
||
- name: Run sync script | ||
run: | | ||
./this/hack/sync-file.sh | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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
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
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
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
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
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
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
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,33 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
# Move into the directory of repo_a and setup git user | ||
git config user.name "GitHub Action" | ||
git config user.email "[email protected]" | ||
|
||
# Copy from api server to local | ||
BRANCH_NAME="update-file-$(date +%Y%m%d%H%M%S)" | ||
FILE_PATH=this/pkg/types_jsonschema.go | ||
cp apiextensions-apiserver/pkg/apis/apiextensions/v1beta1/types_jsonschema.go this/pkg | ||
|
||
# Check if there is a difference between the files | ||
if git diff --exit-code "$FILE_PATH"; then | ||
echo "No changes detected, exiting." | ||
exit 0 | ||
fi | ||
|
||
echo "Changes detected, creating a pull request..." | ||
|
||
# Stage the changes | ||
git add "$FILE_PATH" | ||
git commit -m "Updated $FILE_PATH from repository B" | ||
|
||
# Push the branch to repository A | ||
git push origin "$BRANCH_NAME" | ||
|
||
# Create a pull request using the GitHub CLI | ||
gh auth login --with-token <<< "$GITHUB_TOKEN" | ||
gh pr create --title "Sync $FILE_PATH from repo B" --body "This PR updates $FILE_PATH from repository B" --head "$BRANCH_NAME" --base main | ||
|
||
echo "Pull request created successfully." |
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,11 @@ | ||
# Files in this folder | ||
|
||
Some of the files in this folder are taken from the following repository verbatim: | ||
[Kubernetes Extensions api server repository](https://github.com/kubernetes/apiextensions-apiserver) | ||
|
||
The following files are copied over: | ||
- types_jsonschema.go | ||
- marshal.go | ||
- marshal_test.go | ||
|
||
This is to ensure that we marshal the JSON schema types correctly. |
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
Oops, something went wrong.