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

Refactored default Actions enabled, enabled Python linting #11

Merged
merged 3 commits into from
Jul 10, 2023
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
2 changes: 2 additions & 0 deletions .github/config/.wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ MPL
orgname
OSSF
pre
PR
PRL
Python
reponame
Expand All @@ -25,6 +26,7 @@ README
spellingcheck
superlinter
TODO
URLs
yamllint
YML

12 changes: 0 additions & 12 deletions .github/dependabot.yml

This file was deleted.

17 changes: 17 additions & 0 deletions .github/linters/python.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
version: 1
pylint:
enabled: true
options: ""
ignore: |
missing-docstring,
invalid-name,
broad-except,
logging-fstring-interpolation,
wrong-import-position
conventions: ""
min-public-methods: 1
flake8:
enabled: true
ignore: ""
max_line_length: 79
1 change: 1 addition & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ _Put an `x` in the boxes that apply_

_Put an `x` in the boxes that apply you can view the checklist as a heads up as to what we are going to look for before merging your code._

- [ ] I have added a description of the changes made in this PR to CHANGELOG.md.
- [ ] I have read the CONTRIBUTING.md guidelines for this repository.
- [ ] I have included any and all necessary documentation where appropriate.
- [ ] I will fix any problems reported with this PR by the GitHub Actions on this repository.
Expand Down
52 changes: 0 additions & 52 deletions .github/workflows/bandit.yml

This file was deleted.

77 changes: 0 additions & 77 deletions .github/workflows/codeql.yml

This file was deleted.

81 changes: 41 additions & 40 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,42 @@
---
name: Linter - Workflow
# Trigger the workflow on push or pull request and include main
on:
pull_request:
types:
- opened
- synchronize
push:
branches:
- main
jobs:
super-linter:
# Job name
name: lint-code-base-using-super-linter
# Set the agent to run on
runs-on: ubuntu-latest
# Load all steps
steps:
# Checkout the code base
- name: Check out code
uses: actions/checkout@v3
# Run Linter against code base
- name: Lint code base
uses: docker://github/super-linter:v5
env:
LINTER_RULES_PATH: .github/linters
MARKDOWN_CONFIG_FILE: .markdownlint.json
# Parse the entire repository and find all files to validate across all types.
# NOTE: When set to false, only new or edited files will be parsed for validation.
VALIDATE_ALL_CODEBASE: true
DEFAULT_BRANCH: main
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VALIDATE_JSON: true
VALIDATE_MD: true
VALIDATE_YML: true
# Flag to enable additional information about the linter, versions, and additional output.
ACTIONS_RUNNER_DEBUG: false
# Flag to have the linter complete with exit code 0 even if errors were detected.
DISABLE_ERROR: false
DEFAULT_WORKSPACE: /tmp/lint
name: SuperLinterWorkflow
# Trigger the workflow on push or pull request and include main
on:
pull_request:
types:
- opened
- synchronize
push:
branches:
- main
jobs:
super-linter:
# Job name
name: lint-code-base-using-super-linter
# Set the agent to run on
runs-on: ubuntu-latest
# Load all steps
steps:
# Checkout the code base
- name: Check out code
uses: actions/checkout@v3
# Run Linter against code base
- name: Lint code base
uses: docker://github/super-linter:v5
env:
LINTER_RULES_PATH: .github/linters
MARKDOWN_CONFIG_FILE: .markdownlint.json
# Parse the entire repository and find all files to validate across all types.
# NOTE: When set to false, only new or edited files will be parsed for validation.
VALIDATE_ALL_CODEBASE: true
DEFAULT_BRANCH: main
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VALIDATE_JSON: true
VALIDATE_MD: true
VALIDATE_PYTHON: true
VALIDATE_YML: true
# Flag to enable additional information about the linter, versions, and additional output.
ACTIONS_RUNNER_DEBUG: false
# Flag to have the linter complete with exit code 0 even if errors were detected.
DISABLE_ERROR: false
DEFAULT_WORKSPACE: /tmp/lint
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.4.0] - 2023-07-09

- [CHANGED] Replaced some of the default GitHub action workflow files with instructions in README.md on how to enable workflows.
- [ADDED] Python linting.

## [1.3.1] - 2023-07-03

- [CHANGED] Tidied up badges in README.md.
Expand Down
16 changes: 6 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
This is a template repository for creating new repositories with pre-configured settings and files commonly used in my Python projects.

[![License: MPL 2.0](https://img.shields.io/badge/License-MPL%202.0-brightgreen.svg)](https://opensource.org/licenses/MPL-2.0)
[![Bandit](https://github.com/tom-halpin/template-repo-template/actions/workflows/bandit.yml/badge.svg)](https://github.com/tom-halpin/template-repo-template/actions/new?category=security)
<!--[![Bandit](https://github.com/tom-halpin/template-repo-template/actions/workflows/bandit.yml/badge.svg)](https://github.com/tom-halpin/template-repo-template/actions/new?category=security)-->
[![Super-Linter](https://github.com/tom-halpin/template-repo-template/actions/workflows/linter.yml/badge.svg)](https://github.com/marketplace/actions/super-linter)
[![CodeQL](https://github.com/tom-halpin/template-repo-template/workflows/CodeQL/badge.svg?branch=main)
[![Markdown Links Check](https://github.com/tom-halpin/template-repo-template/actions/workflows/md-links.yml/badge.svg)](https://github.com/gaurav-nelson/github-action-markdown-link-check)
Expand All @@ -23,14 +23,8 @@ It includes bug and feature issue templates, a pull request (PR) template, CodeQ

- ```.github/PULL_REQUEST_TEMPLATE.md```: Template for creating pull requests.

- ```.github/workflows/bandit.yaml```: GitHub Actions workflow for security linter designed to find common security issues in Python code.

- ```.github/codeql.yml```: GitHub Actions workflow for CodeQL analysis.

- ```.github/workflows/coverage.yaml```: GitHub Actions workflow for Python unit test code coverage.

- ```.github/dependabot.yml```: GitHub Actions workflow controlling how Dependabot maintains the repository.

- ```.github/workflows/greetings.yml```: GitHub Actions workflow for automated Greeting messages.

- ```.github/workflows/linter.yml```: GitHub Actions workflow for YML & Markdown validation.
Expand Down Expand Up @@ -67,9 +61,11 @@ The following changes need to be made:

- Review and update ```CODEOWNERS```.

- Enable [CodeQL analysis](https://github.com/tom-halpin/template-repo-template/settings/security_analysis) to identify vulnerabilities and errors with [CodeQL](https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/about-code-scanning-with-codeql).
- Enable [CodeQL analysis](https://github.com/tom-halpin/template-repo-template/settings/security_analysis) to identify vulnerabilities and errors with [CodeQL](https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/about-code-scanning-with-codeql), when enabling select the option to generate - ```.github/codeql.yml```: the GitHub Actions workflow for CodeQL analysis.

- Enable [Dependabot](https://github.com/tom-halpin/template-repo-template/settings/security_analysis) alerts, security updates and version updates when enabling it select the option to generate - ```.github/dependabot.yml```: the configuration file controlling how Dependabot maintains the repository.

- Enable [Dependabot](https://github.com/tom-halpin/template-repo-template/settings/security_analysis) alerts, security updates and version updates.
- Enable [Bandit](https://github.com/genai-musings/chatting-with-ChatGPT/actions/new?category=security) when enabling it select the option to generate - ```.github/bandit.yml```: the GitHub Actions workflow designed to find common security issues in Python code.

- Enable [Secret Scanning with Push Protection](https://github.com/tom-halpin/template-repo-template/settings/security_analysis) to receive alerts on GitHub for detected secrets, keys, or other tokens, and to block commits which contain supported secrets.

Expand All @@ -79,7 +75,7 @@ The following changes need to be made:

- Replace code in ```main.py``` with your code, update tests and associated GitHub action workflows accordingly.

- Review and update ```README.md```.
- Review and update ```README.md```. Remove redundant instructions such as this and update Badges displayed including their URLs.

- Review and enable required linters in the ```.github/workflows/linter.yml``` GitHub action.

Expand Down