Update README.md #9
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
name: Update Documentation | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- 'README.md' | |
jobs: | |
update-docs: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the sample-playmaker-server-python-grpc repository | |
uses: actions/checkout@v3 | |
- name: Set up Git | |
run: | | |
git config --global user.name 'GitHub Actions Bot' | |
git config --global user.email 'actions@github.com' | |
- name: Check if README was updated | |
run: | | |
if git diff --name-only HEAD^ HEAD | grep 'README.md'; then | |
echo "README.md has changed" | |
else | |
echo "README.md has not changed" && exit 0 | |
fi | |
- name: Generate random number for branch name | |
id: random | |
run: echo "::set-output name=random_number::$(shuf -i 1000-9999 -n 1)" | |
- name: Clone the CLSFramework.github.io repository | |
run: | | |
git clone https://github.com/CLSFramework/CLSFramework.github.io.git cls-repo | |
cd cls-repo | |
# Copy updated README to target directory in the CLSFramework.github.io repository | |
cp ../README.md docs/2-sampleserver/0-sample-python-base-code-gRPC/index.md | |
# Create a new branch with a random number appended | |
git checkout -b update-readme-grpc-${{ steps.random.outputs.random_number }} | |
- name: Set up authentication using PAT for CLSFramework.github.io | |
run: | | |
cd cls-repo | |
git remote set-url origin https://x-access-token:${{ secrets.GH_TOKEN }}@github.com/CLSFramework/CLSFramework.github.io.git | |
- name: Commit and Push Changes to CLSFramework.github.io | |
run: | | |
cd cls-repo | |
git add docs/2-sampleserver/0-sample-python-base-code-gRPC/index.md | |
git commit -m "Update sample server documentation from README" | |
git push origin update-readme-grpc-${{ steps.random.outputs.random_number }} | |
- name: Create Pull Request in CLSFramework.github.io | |
uses: peter-evans/create-pull-request@v5 | |
with: | |
token: ${{ secrets.GH_TOKEN }} | |
repository: CLSFramework/CLSFramework.github.io # Explicitly set the target repo | |
branch: update-readme-grpc-${{ steps.random.outputs.random_number }} | |
commit-message: "Update sample server documentation from README" | |
title: "Update sample server documentation" | |
body: "This PR updates the sample server documentation based on changes made in README.md." | |
base: main |