-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Hannah Bollar <[email protected]>
- Loading branch information
Showing
1 changed file
with
58 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,58 @@ | ||
# Auto generate docs as a new commit for the docs repo | ||
name: update readme to docs | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
# branches: | ||
# - main | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
readme-update-to-docs: | ||
runs-on: macos-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Get README content | ||
id: get-readme | ||
run: | | ||
cp README.md ../new-src-index.md | ||
- name: see if info is there | ||
run: | | ||
echo "ll .." | ||
ls -al .. | ||
echo "ll ." | ||
ls -al . | ||
- name: Checkout documentation Repository | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: Volumetrics-io/documentation | ||
ref: main | ||
token: ${{ secrets.MRJS_AND_DOCS_REPO_PAT }} | ||
|
||
- name: Update Docs | ||
run: | | ||
rm "./source/index.md" | ||
mv -f "../new-src-index.md" "./source/index.md" | ||
- name: Commit only if there are changes | ||
run: | | ||
if [[ -n $(git diff --exit-code) ]]; then | ||
echo "Changes detected. Committing and pushing." | ||
git config user.name 'github-actions[bot]' | ||
git config user.email 'github-actions[bot]@users.noreply.github.com' | ||
commit_message=$'👷 MR.js - Auto Generated README to Index Update 👷\n\nChanges at '"${GITHUB_SHA}" | ||
git add . | ||
git commit -m "$commit_message" | ||
git push --quiet --set-upstream origin HEAD | ||
else | ||
echo "No changes detected. Exiting without committing." | ||
fi | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.MRJS_AND_DOCS_REPO_PAT }} | ||
|