Skip to content

Commit

Permalink
Update main.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
naderzare authored Nov 25, 2024
1 parent 072c202 commit 6c75126
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
branches:
- main
paths:
- 'readme.md'
- 'README.md'

jobs:
update-docs:
Expand All @@ -22,10 +22,10 @@ jobs:
- name: Check if README was updated
run: |
if git diff --name-only HEAD^ HEAD | grep 'readme.md'; then
echo "readme.md has changed"
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
echo "README.md has not changed" && exit 0
fi
- name: Generate random number for branch name
Expand All @@ -38,10 +38,10 @@ jobs:
cd cls-repo
# Copy updated README to target directory in the CLSFramework.github.io repository
cp ../readme.md docs/6-basecode/py2d/index.md
cp ../README.md docs/6-basecode/py2d/index.md
# Create a new branch with a random number appended
git checkout -b update-readme-py2d-${{ steps.random.outputs.random_number }}
git checkout -b update-README-py2d-${{ steps.random.outputs.random_number }}
- name: Add front matter to index.md before committing
run: |
Expand All @@ -59,12 +59,12 @@ jobs:
cd cls-repo
git add docs/6-basecode/py2d/index.md
git commit -m "Update py2d documentation from README"
git push origin update-readme-py2d-${{ steps.random.outputs.random_number }}
git push origin update-README-py2d-${{ steps.random.outputs.random_number }}
- name: Create Pull Request in CLSFramework.github.io using GitHub API
run: |
PR_RESPONSE=$(curl -X POST -H "Authorization: token ${{ secrets.GH_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/CLSFramework/CLSFramework.github.io/pulls \
-d '{"title":"Update py2d documentation","head":"update-readme-py2d-${{ steps.random.outputs.random_number }}","base":"main","body":"This PR updates the py2d documentation based on changes made in README.md."}')
-d '{"title":"Update py2d documentation","head":"update-README-py2d-${{ steps.random.outputs.random_number }}","base":"main","body":"This PR updates the py2d documentation based on changes made in README.md."}')
echo "Pull request created: $PR_RESPONSE"

0 comments on commit 6c75126

Please sign in to comment.