Doxygen #2145
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
name: "Doxygen" | |
on: | |
workflow_dispatch: | |
inputs: | |
pr_nr: | |
description: "PR number to create doxygen docs for, if omitted current branch is used." | |
required: false | |
default: "" | |
repo: | |
description: "Repository doxygen docs for." | |
required: true | |
default: "glotaran/pyglotaran" | |
jobs: | |
run-doxygen: | |
name: Doxygen callgraph | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
- name: Install dependencies | |
run: pip install requests | |
- name: Get ref to check out | |
id: ref_to_checkout | |
shell: python | |
run: | | |
import requests | |
import os | |
def pr_by_nr(pr_nr:int): | |
token = os.getenv("GITHUB_TOKEN") | |
repo = "${{ github.event.inputs.repo }}" | |
headers = {"Accept": "application/vnd.github.v3+json"} | |
if token is not None: | |
headers['Authorization'] = f"token {token}" | |
resp = requests.get(f"https://api.github.com/repos/{repo}/pulls", headers=headers) | |
if resp.status_code != 200: | |
resp.raise_for_status() | |
for pr in resp.json(): | |
if pr["number"] == pr_nr: | |
return pr | |
raise ValueError(f"PR with number {pr_nr} could not be found for repo {repo}.") | |
def merge_sha_by_pr_nr(pr_nr:int): | |
return pr_by_nr(pr_nr)["merge_commit_sha"] | |
pr_nr = "${{ github.event.inputs.pr_nr }}" | |
if pr_nr != "": | |
ref = merge_sha_by_pr_nr(int(pr_nr)) | |
else: | |
ref = os.getenv("GITHUB_REF_NAME") | |
with open(os.getenv("GITHUB_OUTPUT"), "a", encoding="utf8") as f: | |
f.writelines([f"ref={ref}"]) | |
- uses: actions/checkout@v4 | |
with: | |
repository: ${{ github.event.inputs.repo }} | |
ref: ${{ steps.ref_to_checkout.outputs.ref }} | |
- name: Create Doxygen Docs | |
uses: mattnotmitt/doxygen-action@v1 | |
with: | |
doxyfile-path: "docs/Doxyfile.ini" | |
- name: Upload Doxygen Docs Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: doxygen_docs_pyglotaran | |
path: doxygen_docs_pyglotaran |