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

Feature/19 integrate the managing script and all managing scripts into one #20

Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
ba2483c
#17 - Action migration to composite
miroslavpojer Jul 3, 2024
5ff6dc9
#17 - Action migration to composite
miroslavpojer Jul 3, 2024
dd4e046
Merge branch 'refs/heads/master' into feature/17-action-migration-to-…
miroslavpojer Jul 17, 2024
b073dc5
Fixed problem after merge of master.
miroslavpojer Jul 17, 2024
fa01591
Temporary commit/backup of latest changes before merge from master.
miroslavpojer Jul 18, 2024
ef0abf9
Merge branch 'refs/heads/master' into feature/19-Integrate-the-managi…
miroslavpojer Jul 18, 2024
25d9de3
Commit to share latest state of code.
miroslavpojer Jul 18, 2024
46d386f
Removed no more used code.
miroslavpojer Jul 18, 2024
514ba3e
- Changes from Review comments.
miroslavpojer Jul 18, 2024
7a6af31
- Fixed type of default value.
miroslavpojer Jul 18, 2024
9583316
- Fixed definition and usage of output-path input and output parameters.
miroslavpojer Jul 19, 2024
2390984
- Improved work with input/output `output-path`. Added mapping to abs…
miroslavpojer Jul 19, 2024
8012970
- Global definition of false as default for input project-state-minin…
miroslavpojer Jul 19, 2024
4c3e995
- Addressed several small review comments.
miroslavpojer Jul 19, 2024
b755731
- Moved one utility method in to utils package.
miroslavpojer Jul 19, 2024
cf2e7fc
- Fixed project issue data init when project mining not allowed.
miroslavpojer Jul 19, 2024
f08e11d
- Fixed copy&paste error.
miroslavpojer Jul 19, 2024
e0cbb39
- Added usage of get_action_input utils method. Updated influenced co…
miroslavpojer Jul 19, 2024
baf891c
- Remove constants.
miroslavpojer Jul 19, 2024
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
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,7 @@ cython_debug/
/.idea/

# Generated outputs
data/
output/

# Debugging script file
run_script.sh
run_me.sh
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ See the full example of action step definition (in example are used non-default
"query-labels": ["improvement"]
}
]'
output-path: "/output/directory/path"
```


Expand Down Expand Up @@ -135,6 +136,7 @@ Configure the action by customizing the following parameters based on your needs
"query-labels": ["improvement"]
}
]'
output-path: "/output/directory/path"
```

### Features de/activation
Expand All @@ -160,7 +162,7 @@ Configure the action by customizing the following parameters based on your needs
## Action Outputs
The Living Documentation Generator action provides a key output that allows users to locate and access the generated documentation easily. This output can be utilized in various ways within your CI/CD pipeline to ensure the documentation is effectively distributed and accessible.

- **documentation-path**
- **output-path**
- **Description**: This output provides the path to the directory where the generated living documentation files are stored.
- **Usage**:
``` yaml
Expand All @@ -169,7 +171,7 @@ The Living Documentation Generator action provides a key output that allows user
... rest of the action definition ...

- name: Output Documentation Path
run: echo "Generated documentation path: ${{ steps.generate_doc.outputs.documentation-path }}"
run: echo "Generated documentation path: ${{ steps.generate_doc.outputs.output-path }}"
```

## Project Setup
Expand Down
17 changes: 9 additions & 8 deletions action.yml
MobiTikula marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,19 @@ inputs:
project-state-mining:
description: 'Enable or disable mining of project state data.'
required: false
default: true
default: 'true'
projects-title-filter:
description: 'Filter projects by titles. Provide a list of project titles.'
required: false
default: '[]'
output-path:
description: 'Path to the generated living documentation files.'
required: false
default: './output'
outputs:
documentation-path:
output-path:
description: 'Path to the generated living documentation files'
value: ${{ steps.liv-doc-generator.outputs.output-path }}

branding:
icon: 'book'
Expand All @@ -28,14 +33,9 @@ runs:
steps:
- name: Install Python dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install -r ${{ github.action_path }}/requirements.txt
shell: bash

- name: Call command python3
run: python3 --version
shell: bash

- name: Set PROJECT_ROOT and update PYTHONPATH
run: |
ACTION_ROOT="${{ github.action_path }}"
Expand All @@ -49,7 +49,8 @@ runs:
INPUT_REPOSITORIES: ${{ inputs.repositories }}
INPUT_PROJECT_STATE_MINING: ${{ inputs.project_state_mining }}
INPUT_PROJECTS_TITLE_FILTER: ${{ inputs.projects_title_filter }}
INPUT_OUTPUT_PATH: ${{ inputs.output-path }}

run: |
python3 ${{ github.action_path }}/src/living_documentation_generator.py
python3 ${{ github.action_path }}/main.py
shell: bash
File renamed without changes.
File renamed without changes.
MobiTikula marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import logging
import os

from action.model.config_repository import ConfigRepository
from living_documentation_generator.action.model.config_repository import ConfigRepository


class ActionInputs:
Expand All @@ -11,7 +11,7 @@ def __init__(self):
self.__is_project_state_mining_enabled: bool = True
self.__projects_title_filter: list = []
self.__repositories: list[ConfigRepository] = []
self.__output_directory: str = "../output"
self.__output_directory: str = ""

MobiTikula marked this conversation as resolved.
Show resolved Hide resolved
@property
def github_token(self) -> str:
Expand All @@ -37,7 +37,8 @@ def load_from_environment(self, validate: bool = True) -> 'ActionInputs':
self.__github_token = os.getenv('GITHUB_TOKEN')
self.__is_project_state_mining_enabled = os.getenv('PROJECT_STATE_MINING').lower() == "true"
self.__projects_title_filter = os.getenv('PROJECTS_TITLE_FILTER')
self.__output_directory = os.getenv('OUTPUT_DIRECTORY', 'output')
out_path = os.getenv('OUTPUT_PATH', './output')
self.__output_directory = self._make_absolute_path(out_path)
repositories_json = os.getenv('REPOSITORIES')

logging.debug(f'Is project state mining allowed: {self.__is_project_state_mining_enabled}')
Expand Down Expand Up @@ -73,3 +74,10 @@ def validate_inputs(self, repositories_json: str) -> None:
# Validate GitHub token
if not self.__github_token:
raise ValueError("GitHub token could not be loaded from the environment")

def _make_absolute_path(self, path):
MobiTikula marked this conversation as resolved.
Show resolved Hide resolved
# If the path is already absolute, return it as is
if os.path.isabs(path):
return path
# Otherwise, convert the relative path to an absolute path
return os.path.abspath(path)
Loading