Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🚇👌 Run Doxygen workflow only on 'workflow_dispatch' #981

Merged
merged 1 commit into from
Jan 30, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 47 additions & 3 deletions .github/workflows/doxygen.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,62 @@
name: "Doxygen"

on: [push, pull_request, workflow_dispatch]
on:
workflow_dispatch:
inputs:
pr_nr:
description: "pyglotaran branch/tag to run the examples against"
required: false
default: ""
repo:
description: "pyglotaran branch/tag to run the examples against"
required: true
default: "glotaran/pyglotaran"

jobs:
run-doxygen:
name: Doxygen callgraph
environment: Debug
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- 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")
print(f"::set-output name=ref::{ref}")
- uses: actions/checkout@v2
with:
repository: ${{ github.event.inputs.repo }}
ref: ${{ steps.ref_to_checkout.outputs.ref }}
- name: Create Doxygen Docs
uses: mattnotmitt/doxygen-action@v1
with:
Expand Down