test workflow; capture issue or pr number in variable #27
Workflow file for this run
This file contains hidden or 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
| name: docs | ||
| on: | ||
| push: | ||
| branches: | ||
| - develop | ||
| - feature/* | ||
| - main/* | ||
| - bugfix/* | ||
| - release/* | ||
| paths: | ||
| - docs/** | ||
| pull_request_target: | ||
| types: [issues, opened, reopened, synchronize] | ||
| paths: | ||
| - docs/** | ||
| workflow_dispatch: | ||
| inputs: | ||
| branch: | ||
| description: 'Branch to build documentation for' | ||
| required: false | ||
| default: 'develop' | ||
| commit: | ||
| description: 'Commit to build documentation for' | ||
| required: false | ||
| default: 'HEAD' | ||
| jobs: | ||
| documentation: | ||
| permissions: | ||
| pull-requests: "write" | ||
| runs-on: ubuntu-latest | ||
| name: Build and deploy documentation | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| - name: Setup Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: "3.13" | ||
| - name: Install (upgrade) python dependencies | ||
| run: | | ||
| pip install --upgrade pip | ||
| pip install -r docs/requirements.txt | ||
| - name: Install (upgrade) latex dependencies | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install texlive-latex-base | ||
| sudo apt-get install texlive-fonts-recommended texlive-fonts-extra | ||
| sudo apt-get install texlive-latex-extra | ||
| sudo apt-get install latexmk | ||
| - name: Build documentation | ||
| run: | | ||
| cd docs | ||
| make html | ||
| make latexpdf | ||
| - name: Upload documentation (on success) | ||
| uses: actions/upload-artifact@v4 | ||
| if: success() | ||
| with: | ||
| name: ee-docs.pdf | ||
| path: docs/_build/latex/ee-docs.pdf | ||
| if-no-files-found: ignore | ||
| # - name: Upload warnings (on failure) | ||
| # uses: actions/upload-artifact@v4 | ||
| # if: failure() | ||
| # with: | ||
| # name: ee-docs.warnings.log | ||
| # path: docs/_build/warnings.log | ||
| # if-no-files-found: ignore | ||
| # | ||
| - name: Comment ReadDocs Link in PR | ||
| # if: ${{ github.event_name == 'pull_request' }} | ||
| uses: actions/github-script@v7 | ||
| with: | ||
| script: | | ||
| const prNumber = context.pull_request?.number || context.issue?.number; | ||
| if (!prNumber) { | ||
| console.log('Could not find a valid pull request or issue number.'); | ||
| return; | ||
| } | ||
| const message = ` | ||
| Link to ReadTheDocs sample build for this PR can be found at: | ||
| https://nws-hpc-standards--${{ github.event.pull_request.number }}.org.readthedocs.build/en/${{ github.event.pull_request.number }} | ||
| ` | ||
| github.rest.issues.createComment({ | ||
| # issue_number: context.issue.number, | ||
| issue_number: prNumber, | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| body: message | ||
| }) | ||