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

feat: vale ignore towncrier directory #478

Merged
merged 8 commits into from
May 6, 2024
Merged
Show file tree
Hide file tree
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
54 changes: 53 additions & 1 deletion doc-style/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,20 @@ inputs:
required: false
type: string

toml-version:
description: >
Toml version used for retrieving the towncrier directory.
default: '0.10.2'
required: false
type: string

ignore-changelogd:
description: >
Whether or not to ignore markdown files in doc/changelog.d/.
default: true
required: false
type: bool

checkout:
description: >
Whether to clone the repository in the CI/CD machine. Default value is
Expand Down Expand Up @@ -108,6 +122,44 @@ runs:
fi
fi

- name: "Install toml"
shell: bash
run: |
python -m pip install --upgrade pip toml==${{ inputs.toml-version }}

- name: "Get towncrier directory"
shell: python
run: |
import os
import toml

# Load pyproject.toml
with open('pyproject.toml', 'r') as f:
config = toml.load(f)
try:
# Get towncrier directory
directory=config["tool"]["towncrier"]["directory"]
except KeyError:
# If towncrier directory isn't specified in pyproject.toml
directory=""

# Get the GITHUB_ENV variable
github_env = os.getenv('GITHUB_ENV')

# Append the TOWNCRIER_DIR with its value to GITHUB_ENV
with open(github_env, "a") as f:
f.write(f"TOWNCRIER_DIR={directory}")

- name: "Check if changelog.d is ignored"
shell: bash
run: |
# If changelog.d is ignored and the TOWNCRIER_DIR exists in pyproject.toml, add the ignore glob
if [[ ${{ inputs.ignore-changelogd }} == 'true' ]] && [[ -n "${{ env.TOWNCRIER_DIR }}" ]]; then
echo VALE_FLAGS="--config=${{ inputs.vale-config }} --glob=!${{ env.TOWNCRIER_DIR }}/*.md" >> $GITHUB_ENV
else
echo VALE_FLAGS="--config=${{ inputs.vale-config }}" >> $GITHUB_ENV
fi

- name: "Run Vale"
uses: errata-ai/vale-action@reviewdog
env:
Expand All @@ -118,5 +170,5 @@ runs:
level: error
filter_mode: nofilter
fail_on_error: true
vale_flags: "--config=${{ inputs.vale-config }}"
vale_flags: "${{ ENV.VALE_FLAGS }}"
version: ${{ inputs.vale-version }}
224 changes: 112 additions & 112 deletions doc/source/style-actions/index.rst
Original file line number Diff line number Diff line change
@@ -1,112 +1,112 @@
Style actions
=============
Style actions verify code and documentation quality compliance
with PyAnsys guidelines.


Code style action
-----------------

.. jinja:: code-style

{{ description }}

{{ inputs_table }}

Examples
++++++++

{% for filename, title in examples %}
.. dropdown:: {{ title }}
:animate: fade-in

.. literalinclude:: examples/{{ filename }}
:language: yaml

{% endfor %}


Doc style action
----------------

.. jinja:: doc-style

{{ description }}

{{ inputs_table }}

Examples
++++++++

{% for filename, title in examples %}
.. dropdown:: {{ title }}
:animate: fade-in

.. literalinclude:: examples/{{ filename }}
:language: yaml

{% endfor %}


Docker style action
-------------------

.. jinja:: docker-style

{{ description }}

{{ inputs_table }}

Examples
++++++++

{% for filename, title in examples %}
.. dropdown:: {{ title }}
:animate: fade-in

.. literalinclude:: examples/{{ filename }}
:language: yaml

{% endfor %}


Commit style action
-------------------

.. jinja:: commit-style

{{ description }}

{{ inputs_table }}

Examples
++++++++

{% for filename, title in examples %}
.. dropdown:: {{ title }}
:animate: fade-in

.. literalinclude:: examples/{{ filename }}
:language: yaml

{% endfor %}


Branch name style action
------------------------

.. jinja:: branch-name-style

{{ description }}

Examples
++++++++

{% for filename, title in examples %}
.. dropdown:: {{ title }}
:animate: fade-in

.. literalinclude:: examples/{{ filename }}
:language: yaml

{% endfor %}
Style actions
=============
Style actions verify code and documentation quality compliance
with PyAnsys guidelines.
Code style action
-----------------
.. jinja:: code-style
{{ description }}
{{ inputs_table }}
Examples
++++++++
{% for filename, title in examples %}
.. dropdown:: {{ title }}
:animate: fade-in
.. literalinclude:: examples/{{ filename }}
:language: yaml
{% endfor %}
Doc style action
----------------
.. jinja:: doc-style
{{ description }}
{{ inputs_table }}
Examples
++++++++
{% for filename, title in examples %}
.. dropdown:: {{ title }}
:animate: fade-in
.. literalinclude:: examples/{{ filename }}
:language: yaml
{% endfor %}
Docker style action
-------------------
.. jinja:: docker-style
{{ description }}
{{ inputs_table }}
Examples
++++++++
{% for filename, title in examples %}
.. dropdown:: {{ title }}
:animate: fade-in
.. literalinclude:: examples/{{ filename }}
:language: yaml
{% endfor %}
Commit style action
-------------------
.. jinja:: commit-style
{{ description }}
{{ inputs_table }}
Examples
++++++++
{% for filename, title in examples %}
.. dropdown:: {{ title }}
:animate: fade-in
.. literalinclude:: examples/{{ filename }}
:language: yaml
{% endfor %}
Branch name style action
------------------------
.. jinja:: branch-name-style
{{ description }}
Examples
++++++++
{% for filename, title in examples %}
.. dropdown:: {{ title }}
:animate: fade-in
.. literalinclude:: examples/{{ filename }}
:language: yaml
{% endfor %}
Loading