refactor ♻️: Convert string to boolean for condition and changed_when #11

Merged
Jose merged 5 commits from dev into main 2026-02-14 08:45:14 +01:00
Owner

Refactored the code to convert string values to boolean for conditional checks and update the changed_when attribute accordingly.

Refactored the code to convert string values to boolean for conditional checks and update the `changed_when` attribute accordingly.
Jose added 4 commits 2026-02-14 08:40:38 +01:00
feat : Add task to gather active swaps and comment swap entries in fstab
Some checks failed
ansible-lint / Ansible Lint (push) Failing after 11s
Gitleaks Scan / gitleaks (push) Successful in 4s
Markdown Lint / markdown-lint (push) Successful in 7s
3be8cd10be
This commit introduces a new feature that adds a task to gather information about active swaps on the system. Additionally, it comments out existing swap entries in the `/etc/fstab` file to prevent them from being mounted at boot.
refactor ♻️: Refactor task to use ansible.builtin.command for compatibility
Some checks failed
ansible-lint / Ansible Lint (push) Failing after 11s
Gitleaks Scan / gitleaks (push) Successful in 4s
Markdown Lint / markdown-lint (push) Successful in 5s
8199aabc38
Updated the task to use `ansible.builtin.command` instead of the deprecated `command` module for better compatibility with newer Ansible versions.
refactor ♻️: Refactor workflows to include issues and push events, add PR check workflow
Some checks failed
ansible-lint / Ansible Lint (push) Failing after 12s
Gitleaks Scan / gitleaks (push) Successful in 4s
Markdown Lint / markdown-lint (push) Successful in 5s
75693ebf2e
This commit refactors the existing workflows by removing 'pull_request' triggers from ansible-lint and markdown-lint.yml files. It also adds a new workflow file `.gitea/workflows/pr-check-yaml` for performing checks on pull requests.
refactor ♻️: Convert string to boolean for condition and changed_when
All checks were successful
ansible-lint / Ansible Lint (push) Successful in 11s
Gitleaks Scan / gitleaks (push) Successful in 4s
Markdown Lint / markdown-lint (push) Successful in 5s
ai-reviews / Review PR (pull_request) Successful in 27s
cbd2f38da0
Refactored the code to convert string values to boolean for conditional checks and update the `changed_when` attribute accordingly.
gitea-actions bot reviewed 2026-02-14 08:41:05 +01:00
gitea-actions bot left a comment

Review Summary

  • .gitea/workflows/ansible-lint.yml: Changes in the provided git diff focus on the pipeline triggers of the Ansible lint workflow. The workflow now only runs on 'push' events and no longer on 'pull_request' or 'issues'. This change may affect maintainability and potential issue detection, especially for pull requests.
  • .gitea/workflows/gitleaks.yml: Removed unnecessary triggers for pull requests and workflows are now only triggered by issues and pushes. No critical, major or moderate issues were found in this change.
  • .gitea/workflows/markdown-lint.yml: Changes in the workflow file for Markdown Lint: The workflow will now only trigger on 'push' events and not on 'pull_request' or 'issues'. This might cause delays in linting checks for pull requests but could help reduce unnecessary notifications.
  • .gitea/workflows/pr-check-yaml: The provided Git diff creates a new workflow file for CI checks in a Git repository. This workflow includes several steps to run leak testing, linting, and other checks on the pull request files. Let's review the changes. LGTM - Logic looks good, no issues with Score >= 2 were found. However, for better maintainability, it might be beneficial to: - [Score: 3] Consider using a dedicated workflow file for each type of check (leak test, linting, etc.) instead of having them all in one file. This would make the workflow easier to manage and understand. - [Score: 3] Add comments explaining what each job does and why it is included in the workflow. This will help future maintainers quickly understand the purpose of the various steps. These suggestions are not critical issues but could improve the maintainability of the workflow over time.
  • tasks/swap.yml: Changes in this diff focus on modifying the swap management of a system, adding comments to swap entries in fstab and using a more specific regular expression for replacement.
# Review Summary * **.gitea/workflows/ansible-lint.yml**: Changes in the provided git diff focus on the pipeline triggers of the Ansible lint workflow. The workflow now only runs on 'push' events and no longer on 'pull_request' or 'issues'. This change may affect maintainability and potential issue detection, especially for pull requests. * **.gitea/workflows/gitleaks.yml**: Removed unnecessary triggers for pull requests and workflows are now only triggered by issues and pushes. No critical, major or moderate issues were found in this change. * **.gitea/workflows/markdown-lint.yml**: Changes in the workflow file for Markdown Lint: The workflow will now only trigger on 'push' events and not on 'pull_request' or 'issues'. This might cause delays in linting checks for pull requests but could help reduce unnecessary notifications. * **.gitea/workflows/pr-check-yaml**: The provided Git diff creates a new workflow file for CI checks in a Git repository. This workflow includes several steps to run leak testing, linting, and other checks on the pull request files. Let's review the changes. **LGTM** - Logic looks good, no issues with Score >= 2 were found. However, for better maintainability, it might be beneficial to: - [Score: 3] Consider using a dedicated workflow file for each type of check (leak test, linting, etc.) instead of having them all in one file. This would make the workflow easier to manage and understand. - [Score: 3] Add comments explaining what each job does and why it is included in the workflow. This will help future maintainers quickly understand the purpose of the various steps. These suggestions are not critical issues but could improve the maintainability of the workflow over time. * **tasks/swap.yml**: Changes in this diff focus on modifying the swap management of a system, adding comments to swap entries in fstab and using a more specific regular expression for replacement.
@@ -2,7 +2,7 @@
# .gitea/workflows/ansible-lint.yml
name: ansible-lint

[Lines 2-3] [Score: 3] Removing the 'on: pull_request' event may impact issue detection for pull requests. Consider if this change is intended.

[Lines 2-3] [Score: 3] Removing the 'on: pull_request' event may impact issue detection for pull requests. Consider if this change is intended.
@@ -3,3 +3,3 @@
name: Markdown Lint
on: [pull_request, issues, push]
on: [issues, push]

[Score: 2] Removing the 'pull_request' event could impact timely linting for pull requests. Consider adding it back if necessary.

[Score: 2] Removing the 'pull_request' event could impact timely linting for pull requests. Consider adding it back if necessary.
Jose added 1 commit 2026-02-14 08:42:37 +01:00
refactor ♻️: Rename workflow from 'ai-reviews' to 'PR check'
All checks were successful
ansible-lint / Ansible Lint (push) Successful in 12s
Gitleaks Scan / gitleaks (push) Successful in 5s
ai-reviews / Review PR (pull_request) Successful in 24s
Markdown Lint / markdown-lint (push) Successful in 5s
535aeb2c0c
Refactored the workflow name from 'ai-reviews' to 'PR check' to improve clarity and consistency within the project.
gitea-actions bot reviewed 2026-02-14 08:43:18 +01:00
gitea-actions bot left a comment

Review Summary

  • .gitea/workflows/ansible-lint.yml: Changes Summary: The change in the workflow file removes on: [pull_request] from trigger events for the Ansible lint job. Now, it will only run on issues and push events. Potential Issue: - Score: 2 - File: .gitea/workflows/ansible-lint.yml - Context: -on: [pull_request, issues, push] - StartLine: 5 - EndLine: 5 - Comment: [Score: 2] Removing pull_request event might prevent automatic linting for pull requests, which could lead to inconsistencies in the codebase. Consider adding it back or setting up a separate workflow for pull requests.
  • .gitea/workflows/gitleaks.yml: Changes in the gitleaks.yml workflow file: The workflow is now triggered on both 'push' events and 'issues'. Previously it was also listening for 'pull_request' events, but that has been removed. This could potentially make the workflow more efficient by not scanning pull request events if they are not necessary.
  • .gitea/workflows/markdown-lint.yml: Removed the on event for pull requests, now only triggering the workflow on issues and pushes. This might cause a delay in linting pull requests as they are no longer automatically checked. (Score: 2)
  • .gitea/workflows/pr-check-yaml: This code defines a workflow for GitHub, which checks for leaks and linting issues in pull requests. The workflow consists of several jobs that run tests on the code, handle failures or successes, and make comments or update labels accordingly. While the provided code looks good overall, there are some minor optimizations and potential improvements: Despite these suggestions, overall the code looks good and follows best practices for maintainability and security. LGTM
  • tasks/swap.yml: Summary: This code snippet introduces a new feature to gather active swaps and modifies the condition for disabling swap based on the output of swapon --noheadings --show=NAME. The replace task in fstab is also modified to comment swap entries. Issue Found: - [Score: 3] Moderate: A new regular expression (Line 25) is introduced for replacing swap entries in the fstab file. Instead of using a more specific and safe regex, it could be replaced with an anchored one to avoid potential false positives or unintended modifications.
# Review Summary * **.gitea/workflows/ansible-lint.yml**: **Changes Summary:** The change in the workflow file removes `on: [pull_request]` from trigger events for the Ansible lint job. Now, it will only run on issues and push events. **Potential Issue:** - Score: 2 - File: .gitea/workflows/ansible-lint.yml - Context: -on: [pull_request, issues, push] - StartLine: 5 - EndLine: 5 - Comment: [Score: 2] Removing pull_request event might prevent automatic linting for pull requests, which could lead to inconsistencies in the codebase. Consider adding it back or setting up a separate workflow for pull requests. * **.gitea/workflows/gitleaks.yml**: Changes in the `gitleaks.yml` workflow file: The workflow is now triggered on both 'push' events and 'issues'. Previously it was also listening for 'pull_request' events, but that has been removed. This could potentially make the workflow more efficient by not scanning pull request events if they are not necessary. * **.gitea/workflows/markdown-lint.yml**: Removed the on event for pull requests, now only triggering the workflow on issues and pushes. This might cause a delay in linting pull requests as they are no longer automatically checked. (Score: 2) * **.gitea/workflows/pr-check-yaml**: This code defines a workflow for GitHub, which checks for leaks and linting issues in pull requests. The workflow consists of several jobs that run tests on the code, handle failures or successes, and make comments or update labels accordingly. While the provided code looks good overall, there are some minor optimizations and potential improvements: Despite these suggestions, overall the code looks good and follows best practices for maintainability and security. **LGTM** * **tasks/swap.yml**: **Summary:** This code snippet introduces a new feature to gather active swaps and modifies the condition for disabling swap based on the output of `swapon --noheadings --show=NAME`. The replace task in fstab is also modified to comment swap entries. **Issue Found:** - [Score: 3] Moderate: A new regular expression (Line 25) is introduced for replacing swap entries in the fstab file. Instead of using a more specific and safe regex, it could be replaced with an anchored one to avoid potential false positives or unintended modifications.
@@ -3,3 +3,3 @@
name: Markdown Lint
on: [pull_request, issues, push]
on: [issues, push]

[Score: 2] Removed on event for pull requests which might cause a delay in linting pull requests as they are no longer automatically checked.

[Score: 2] Removed on event for pull requests which might cause a delay in linting pull requests as they are no longer automatically checked.

[Lines 47-48] [Score: 2] Potential performance issue due to the recursive pattern ("**/*.md") in the globs argument of npx markdownlint-cli2. It may be faster to specify only .md files explicitly if the number of them is reasonable.

[Lines 47-48] [Score: 2] Potential performance issue due to the recursive pattern ("**/*.md") in the globs argument of `npx markdownlint-cli2`. It may be faster to specify only .md files explicitly if the number of them is reasonable.
@@ -18,3 +24,2 @@
path: /etc/fstab
regexp: '^\S+\s+\S+\s+swap\s+.*$'
replace: ''
regexp: '^(\s*)(?!#)(\S+\s+\S+\s+swap\s+.*)$'

[Score: 3] Consider using an anchored regular expression to avoid potential false positives or unintended modifications. For example, use (?x)^(\s*)(?P<swap>^(\S+\s+\S+\s+swap\s.*))$ instead. This will ensure that only the swap lines are commented and not other lines containing 'swap'.

[Score: 3] Consider using an anchored regular expression to avoid potential false positives or unintended modifications. For example, use `(?x)^(\s*)(?P<swap>^(\S+\s+\S+\s+swap\s.*))$` instead. This will ensure that only the swap lines are commented and not other lines containing 'swap'.
Jose merged commit 9484204b24 into main 2026-02-14 08:45:14 +01:00
Sign in to join this conversation.