-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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 #11677 from sharifelgamal/auto-gen-docs
Automatically run `make generate-docs` after every PR merge
- Loading branch information
Showing
5 changed files
with
82 additions
and
39 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,18 @@ | ||
name: "generate-docs" | ||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
generate-docs: | ||
runs-on: ubuntu-18.04 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.16.4 | ||
stable: true | ||
- name: gendocs | ||
run: | | ||
./hack/generate_docs.sh ${{ secrets.MINIKUBE_BOT_PAT }} |
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,53 @@ | ||
#!/bin/bash | ||
|
||
# Copyright 2021 The Kubernetes Authors All rights reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
set -x | ||
|
||
if [ "$#" -ne 1 ]; then | ||
# there's no secret and therefore no reason to run this script | ||
exit 0 | ||
fi | ||
|
||
install_gh() { | ||
export access_token="$1" | ||
|
||
# Make sure gh is installed and configured | ||
./hack/jenkins/installers/check_install_gh.sh | ||
} | ||
|
||
config_git() { | ||
git config user.name "minikube-bot" | ||
git config user.email "minikube-bot@google.com" | ||
} | ||
|
||
make generate-docs | ||
|
||
# If there are changes, open a PR | ||
git diff-index --quiet HEAD -- | ||
if [ $? -gt 0 ]; then | ||
install_gh $1 | ||
config_git | ||
|
||
branch=gendocs$(date +%s%N) | ||
git checkout -b $branch | ||
|
||
git add . | ||
git commit -m "Update generate-docs" | ||
|
||
git remote add minikube-bot https://minikube-bot:$1@github.com/minikube-bot/minikube.git | ||
git push -u minikube-bot $branch | ||
gh pr create --repo kubernetes/minukube --base master --title "Update generate-docs" --body "Committing changes resulting from \`make generate-docs\`" | ||
fi |
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