Skip to content

Commit 9066669

Browse files
authored
[skip ci] comment built docs URL
1 parent 0d34cb4 commit 9066669

File tree

1 file changed

+21
-9
lines changed

1 file changed

+21
-9
lines changed

.github/workflows/pr_build.yml

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,15 @@ jobs:
1313
runs-on: ubuntu-latest
1414

1515
steps:
16+
- name: Prepare environment variables
17+
run: |
18+
ref=${GITHUB_REF#refs/pull/}
19+
pr_num=${ref%/merge}
20+
21+
echo "::set-env name=PR_BUILD_ID::${GITHUB_BASE_REF}/${pr_num}"
22+
echo "::set-env name=DOCS_BASE_DIR::build/html"
23+
echo "::set-env name=DOCS_OUTPUT_DIR::${DOCS_BASE_DIR}/${PR_BUILD_ID}"
24+
1625
- name: Checkout cpython repository
1726
uses: actions/checkout@v2
1827
with:
@@ -38,22 +47,25 @@ jobs:
3847
sudo apt-get update
3948
sudo apt-get install -y --no-install-recommends python3-venv
4049
41-
- name: Build and publish doc
50+
- name: Build docs
4251
run: |
43-
ref=${GITHUB_REF#refs/pull/}
44-
pr_num=${ref%/merge}
45-
output_dir=build/html/${{ github.base_ref }}/${pr_num}
46-
4752
cd cpython/Doc
4853
make venv
49-
rm -rf ${output_dir}
50-
make build ALLSPHINXOPTS="-b html -D language=ja -D gettext_compact=0 -E -d build/doctrees . ${{ github.workspace }}/${output_dir}"
51-
ls -l ${{ github.workspace }}/${output_dir}
54+
rm -rf ${DOCS_OUTPUT_DIR}
55+
make build ALLSPHINXOPTS="-b html -D language=ja -D gettext_compact=0 -E -d build/doctrees . ${{ github.workspace }}/${DOCS_OUTPUT_DIR}"
56+
ls -l ${{ github.workspace }}/${DOCS_OUTPUT_DIR}
5257
53-
cd ${{ github.workspace }}/build/html
58+
- name: Publish docs
59+
cd ${{ github.workspace }}/${DOCS_BASE_DIR}
5460
git config --local user.name "Autobuild bot on GitHub Actions"
5561
git config --local user.email "githubaction-build-bot@example.com"
5662
git add .
5763
if [ $(git status -s | wc -l) -eq 0 ]; then echo "nothing to commit"; exit 0; fi
5864
git commit -m 'update html'
5965
git push "https://${{ github.token }}@github.com/${{ github.repository }}.git" gh-pages:gh-pages
66+
67+
- name: Notify the URL of the built docs
68+
uses: thollander/actions-comment-pull-request@master
69+
with:
70+
message: "Please check the built documentation!!! https://python.github.io/python-docs-ja/${PR_BUILD_ID}"
71+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)