Bug fix: Fix update-documentation action (#72)
fix update-documentation action
This commit is contained in:
parent
535799a8fd
commit
73db1be583
1 changed files with 11 additions and 15 deletions
24
.github/workflows/update-documentation.yml
vendored
24
.github/workflows/update-documentation.yml
vendored
|
@ -20,31 +20,27 @@ jobs:
|
||||||
|
|
||||||
- name: Add and Commit Documentation
|
- name: Add and Commit Documentation
|
||||||
id: push_image_info
|
id: push_image_info
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
set -e
|
set -e
|
||||||
echo "Start."
|
echo "Start."
|
||||||
|
|
||||||
GIT_BRANCH=$(echo "${{ github.ref }}" | grep -oP 'refs/(heads|tags)/\K(.+)')
|
# Configure git and Push updates
|
||||||
if [ "$GIT_BRANCH" == "" ]; then
|
git config --global user.email github-actions@github.com
|
||||||
echo "ERR: Could not determine branch."
|
git config --global user.name github-actions
|
||||||
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
|
git config pull.rebase false
|
||||||
|
|
||||||
# # Pull in anything that may have come in
|
branch=automated-documentation-update-$GITHUB_RUN_ID
|
||||||
# git pull "https://ci:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}" "HEAD:$GIT_BRANCH"
|
git checkout -b $branch
|
||||||
|
message='Automated documentation update'
|
||||||
|
|
||||||
# Add / update and commit
|
# Add / update and commit
|
||||||
git add */**/README.md
|
git add */**/README.md
|
||||||
git status
|
|
||||||
git commit -m 'Automated documentation update' || export NO_UPDATES=true
|
git commit -m 'Automated documentation update' || export NO_UPDATES=true
|
||||||
|
|
||||||
# Push
|
# Push
|
||||||
if [ "$NO_UPDATES" != "true" ] ; then
|
if [ "$NO_UPDATES" != "true" ] ; then
|
||||||
git push "https://ci:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}" "HEAD:$GIT_BRANCH"
|
git push origin "$branch"
|
||||||
|
gh pr create --title "$message" --body "$message"
|
||||||
fi
|
fi
|
Loading…
Reference in a new issue