Clean some docs for use with reusable workflows #469
Workflow file for this run
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: Check, Build, and Publish Documentation | |
on: | |
# Triggers the workflow on push or pull request events | |
push: | |
pull_request: | |
# Trigger when a release is created | |
# NOTE: This will only trigger if the release is created from the UI or with a personal access token | |
release: | |
types: | |
- published | |
# Trigger with the release workflow finishes | |
workflow_run: | |
workflows: ['Create a New Release'] | |
types: [completed] | |
branches: [master] | |
# Also give a manual trigger | |
workflow_dispatch: | |
inputs: | |
publish: | |
description: 'Publish Documentation to GitHub Pages' | |
required: false | |
type: boolean | |
default: false | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
check_menu_inclusion: | |
runs-on: ubuntu-latest | |
if: ${{ ! contains(github.event.head_commit.message, 'ci skip') }} | |
name: Check that all classes are documented in the menu-a-la-carte example | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
# Using answer from here to get the exit code and pass the output: https://stackoverflow.com/questions/59191913/how-do-i-get-the-output-of-a-specific-step-in-github-actions | |
- name: check for classes in the menu example | |
id: check_component | |
continue-on-error: true | |
run: | | |
cd $GITHUB_WORKSPACE/continuous_integration | |
python check_component_inclusion.py 2>&1 | tee check_component.log | |
result_code=${PIPESTATUS[0]} | |
missing_menu_docs=$(cat check_component.log) | |
missing_menu_docs="${missing_menu_docs//'%'/'%25'}" | |
missing_menu_docs="${missing_menu_docs//$'\n'/'%0A'}" | |
missing_menu_docs="${missing_menu_docs//$'\r'/'%0D'}" | |
echo "missing_menu_docs=missing_menu_docs" >> $GITHUB_OUTPUT | |
if [[ $result_code ]]; then | |
echo "$(cat check_component.log)" >> $GITHUB_STEP_SUMMARY | |
else | |
echo "Valid library.json =)" >> $GITHUB_STEP_SUMMARY | |
fi | |
echo "Finished menu inclusion verification" | |
exit $result_code | |
- name: Create commit comment | |
uses: peter-evans/commit-comment@v3 | |
if: steps.check_component.outcome=='failure' | |
with: | |
body: | | |
All sensor and variable subclasses must be included in the Menu a la Carte example | |
${{ steps.check_component.outputs.missing_menu_docs }} | |
- name: Fail if cannot find all menu flags | |
id: verification_failure | |
if: steps.check_component.outcome=='failure' | |
run: exit 1 | |
doc_build: | |
if: ${{ (! contains(github.event.head_commit.message, 'ci skip')) && (github.event_name != 'workflow_run' || (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success')) }} | |
name: Build documentation | |
uses: EnviroDIY/workflows/.github/workflows/build_documentation.yaml@main | |
with: | |
use_graphviz: false | |
publish: ${{ (github.event_name == 'release' && github.event.action == 'published') || (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success') || (github.event_name == 'workflow_dispatch' && github.event.inputs.publish == 'true')}} | |
rebuild_cache_number: 1 | |
secrets: inherit |