canonical / discourse-gatekeeper

Experimental GitHub Action to upload charm documentation to charmhub
Apache License 2.0
7 stars 7 forks source link

Prepare discourse-gatekeeper for PAAS app charmer #238

Closed javierdelapuente closed 3 months ago

javierdelapuente commented 4 months ago

Applicable spec:

Overview

These are the requirements for PAAS app charmer with respect to discourse-gatekeeper:

Currently, the name and the link to the documentation are just read from the metadata.yaml file. However, the new recommended way is to set in the charmcraft.yaml file (see https://juju.is/docs/sdk/charmcraft-yaml). This PR reads those fields from charmcraft.yaml if metadata.yaml does not exist. This PR does not take into account the case where name is one file and the link to the doc is in the other file. In that case, the suggestion could be to put both fields in the same file (preferably charmcraft.yaml).

Besides there is a new input variable, charm_dir, thats allows to customise the place where the metadata/charmcraft file is placed and where the docs directory is.

It was necessary to delete the rate_limit_new_user_create_topic, as it does not exist anymore in discourse (before that, it was not used in discourse anyway).

Rationale

It was not possible to use this project for PAAS app charmer autogenerated projects, as they use the charmcraft.yaml file and the charm directory is not in the root of the repository.

Module Changes

Checklist

github-actions[bot] commented 4 months ago

Test coverage for 94878cc19c5e4a340f5162d72786aff8c9933ecb

Name                      Stmts   Miss Branch BrPart  Cover   Missing
---------------------------------------------------------------------
src/__init__.py              97      0     42      0   100%
src/action.py               155      0     46      0   100%
src/check.py                 63      0     25      0   100%
src/clients.py               12      0      0      0   100%
src/commit.py                42      0     12      0   100%
src/constants.py              9      0      0      0   100%
src/content.py               50      0     10      0   100%
src/discourse.py            159      0     34      0   100%
src/docs_directory.py        33      0      8      0   100%
src/download.py              22      0      2      0   100%
src/exceptions.py            15      0      0      0   100%
src/index.py                142      0     56      0   100%
src/metadata.py              59      0     28      0   100%
src/migration.py            102      0     33      0   100%
src/navigation_table.py      65      0     20      0   100%
src/reconcile.py            123      0     60      0   100%
src/repository.py           293      0     88      0   100%
src/sort.py                  43      0     26      0   100%
src/types_.py               202      0     54      0   100%
---------------------------------------------------------------------
TOTAL                      1686      0    544      0   100%

Static code analysis report

Working... ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 0:00:01
Run started:2024-03-27 09:39:17.944192

Test results:
    No issues identified.

Code scanned:
    Total lines of code: 17815
    Total lines skipped (#nosec): 3
    Total potential issues skipped due to specifically being disabled (e.g., #nosec BXXX): 0

Run metrics:
    Total issues (by severity):
        Undefined: 0
        Low: 0
        Medium: 0
        High: 0
    Total issues (by confidence):
        Undefined: 0
        Low: 0
        Medium: 0
        High: 0
Files skipped (0):