Update Docs #106
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
# Copyright (c) Microsoft Corporation. All rights reserved. | |
# Licensed under the MIT License. | |
name: "Update Docs" | |
on: | |
push: | |
branches: main | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
run-php-documentor: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/[email protected] | |
with: | |
ref: ${{ github.ref }} | |
- uses: docker://phpdoc/phpdoc:3.0 | |
with: | |
config: ./phpdoc.dist.xml | |
- name: Create unique docs branch name | |
run: echo "BRANCH=fix/update-docs/$(date +%s)" >> $GITHUB_ENV | |
- name: Create and checkout docs branch | |
run: git checkout -b ${{ env.BRANCH }} | |
- name: Run PHPDocumentor container | |
run: docker run --name phpDoc --rm -v $(pwd):/data phpdoc/phpdoc:3.0 run | |
- name: Config Git user | |
run: | | |
if git add . && git commit -m "Update docs/ folder"; then | |
git push origin ${{ env.BRANCH }} && echo "CREATE_PR=true" >> $GITHUB_ENV | |
else | |
echo "CREATE_PR=false" >> $GITHUB_ENV | |
fi | |
- name: Create PR | |
if: ${{ env.CREATE_PR == 'true' }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
MESSAGE_TITLE: Generated docs using PHPDocumentor | |
MESSAGE_BODY: "This pull request was automatically created by GitHub Action `${{ github.workflow }}`. \n\n The action runs PHPDocumentor against the latest changes merged to `${{ github.ref }}`." | |
LABELS: generated | |
run: | | |
curl -fsSL https://github.com/github/hub/raw/master/script/get | bash -s 2.14.1 | |
bin/hub pull-request -b main -m "$MESSAGE_TITLE" -m "$MESSAGE_BODY" -l "$LABELS" |