Skip to content

update documentation #230

update documentation

update documentation #230

# Useful in a temporary manner until we fully release the public repo
name: Generate readme file with codebundle index
on:
workflow_dispatch:
push:
branches:
- main
paths:
- "codebundles/**.robot"
- "libraries/**.py"
- "readme_header.md"
- ".github/scripts/index.py"
- ".github/scripts/meta.py"
- ".github/workflows/generate-index.yml"
jobs:
update-readme:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.ref }}
- name: Update PYTHONPATH
run: |
echo "PYTHONPATH=$PYTHONPATH:.:$(pwd)/libraries:$(pwd)/coebundles:$(pwd)/dev_facade" >> $GITHUB_ENV
echo "Python path set as: $PYTHONPATH"
- name: Update readme and commit back to repo
run: |
DATETIME=$(date '+%Y%m%d-%H%M%S')
BRANCH="automatic-index-update-$DATETIME"
git config --global user.email "${GITHUB_ACTOR}"
git config --global user.name "${GITHUB_ACTOR}@users.noreply.github.com"
git checkout -b $BRANCH
# Run the index update script
pip install robotframework==6.0.2
python3 .github/scripts/index.py .github/scripts/index-config.yaml
git add README.md
# Run the metadata generation script
python3 .github/scripts/meta.py codebundles/
git add codebundles/**/meta.yaml
# Generate keyword docs
pip install pydoc-markdown==4.8.2
./.github/scripts/pydoc2md.sh libraries/ libraries/.docs/
git add libraries/.docs/
# Generate gitbook summary
./.github/scripts/gitbook-summary.sh
git add SUMMARY.md
# Test if any git changes are made. If not, bail out and send instruction.
if [ -z "$(git diff-index HEAD)" ]
then
echo "No git changes detected"
exit 0
else
echo "Changes detected. Pushing..."
git commit -m "Codebundle index update."
git push --set-upstream origin $BRANCH
fi
# Open up a PR
PR_OUTPUT=$(curl -X POST -H "Authorization: Token ${{ secrets.GITHUB_TOKEN }}" -H "Accept: application/vnd.github.v3+json" -d "{\"title\":\"automatic-index-update\",\"head\":\"$BRANCH\",\"base\":\"main\",\"body\":\"automatic-index-update\" }" https://api.github.com/repos/${{ github.event.repository.owner.login }}/${{ github.event.repository.name }}/pulls)
PR_LINK=$(echo $PR_OUTPUT | jq '._links.html.href' )
PR_LINK=$(echo $PR_LINK | tr -d '"')
# attempt auto merge but accept fail
# disabling for now
# gh pr merge --auto --squash $PR_LINK
env:
GH_TOKEN: ${{ github.token }}