Update readme_header.md #80
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
# 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" | |
- "readme_header.md" | |
- ".github/scripts/index.py" | |
- ".github/workflows/generate-index.yml" | |
jobs: | |
update-readme: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.base.ref }} | |
- name: Update readme and commit back to repo | |
run: | | |
git config --global user.email "${GITHUB_ACTOR}" | |
git config --global user.name "${GITHUB_ACTOR}@users.noreply.github.com" | |
git checkout -b "automatic-index-update" | |
# Run the index update script | |
pip install robotframework | |
python3 .github/scripts/index.py .github/scripts/index-config.yaml | |
git add README.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 automatic-index-update | |
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":"automatic-index-update","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 }} |