features/.github/workflows/update-documentation.yml

50 lines
1.6 KiB
YAML
Raw Normal View History

name: "Update Documentation"
on:
push:
branches:
- main
workflow_dispatch:
jobs:
generate:
runs-on: ubuntu-latest
2022-06-14 03:02:41 +03:00
if: "!contains(github.event.head_commit.message, 'no-ci') && !contains(github.event.head_commit.message, 'CI ignore')"
steps:
- uses: actions/checkout@v2
- name: Generate Documentation
uses: ./.github/devcontainers-action # devcontainers/action
with:
generate-docs: "true"
base-path-to-features: "./src"
- name: Add and Commit Documentation
id: push_image_info
run: |
set -e
echo "Start."
GIT_BRANCH=$(echo "${{ github.ref }}" | grep -oP 'refs/(heads|tags)/\K(.+)')
if [ "$GIT_BRANCH" == "" ]; then
echo "ERR: Could not determine branch."
exit 1
fi
echo "GIT_BRANCH = ${GIT_BRANCH}"
git config --global user.email "vscr-feedback@microsoft.com"
git config --global user.name "Devcontainers CI"
git config pull.rebase false
# # Pull in anything that may have come in
# git pull "https://ci:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}" "HEAD:$GIT_BRANCH"
# Add / update and commit
git add */**/README.md
git status
git commit -m 'Automated documentation update' || export NO_UPDATES=true
# Push
if [ "$NO_UPDATES" != "true" ] ; then
git push "https://ci:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}" "HEAD:$GIT_BRANCH"
fi