Skip to content

ops4life/github-repo-template

Repository files navigation

πŸ› οΈ GitHub Repo Template

Documentation

Welcome to the Template Repository on GitHub! This repository is designed to serve as a starting point for creating new Git repositories with best practices and configurations already set up.

πŸ“š View Full Documentation - Comprehensive guides, tutorials, and API reference

Below is a brief overview of the structure and the purpose of each file and directory in this repository.

πŸ“ Repository Structure

.
β”œβ”€β”€ .editorconfig                       # πŸ–ŠοΈ Configuration for consistent coding styles
β”œβ”€β”€ .gitattributes                      # πŸ“‹ Git attributes configuration
β”œβ”€β”€ .github                             # πŸ› οΈ GitHub-specific configurations
β”‚   β”œβ”€β”€ CONTRIBUTING.md                 # 🀝 Contribution guidelines
β”‚   β”œβ”€β”€ ISSUE_TEMPLATE                  # πŸ“ GitHub issue templates
β”‚   β”‚   β”œβ”€β”€ bug_report.md               # πŸ› Bug report template
β”‚   β”‚   β”œβ”€β”€ config.yml                  # βš™οΈ Issue template configuration
β”‚   β”‚   β”œβ”€β”€ documentation.md            # πŸ“š Documentation issue template
β”‚   β”‚   β”œβ”€β”€ feature_request.md          # ✨ Feature request template
β”‚   β”‚   └── issue_template.md           # πŸ“ General issue template
β”‚   β”œβ”€β”€ SECURITY.md                     # πŸ”’ Security policy and vulnerability reporting
β”‚   β”œβ”€β”€ dependabot.yml                  # πŸ€– Dependabot configuration
β”‚   β”œβ”€β”€ pull_request_template.md        # πŸ“ Pull request template
β”‚   └── workflows                       # βš™οΈ GitHub Actions workflows
β”‚       β”œβ”€β”€ automerge.yml               # πŸ”€ Auto-merge workflow for dependabot PRs
β”‚       β”œβ”€β”€ cleanup-caches.yaml         # 🧹 Cleanup old workflow caches
β”‚       β”œβ”€β”€ codeql.yaml                 # πŸ” CodeQL security analysis workflow
β”‚       β”œβ”€β”€ deps-review.yaml            # πŸ“‹ Dependency review workflow
β”‚       β”œβ”€β”€ gitleaks.yaml               # πŸ”’ Secret scanning workflow
β”‚       β”œβ”€β”€ lint-pr.yaml                # 🧹 Linting workflow for pull requests
β”‚       β”œβ”€β”€ pre-commit-auto-update.yaml # πŸ”„ Pre-commit hook auto-update workflow
β”‚       β”œβ”€β”€ pre-commit-ci.yaml          # βœ… Pre-commit CI workflow
β”‚       β”œβ”€β”€ release.yaml                # πŸš€ Release workflow
β”‚       β”œβ”€β”€ stale.yaml                  # ⏳ Stale issue management workflow
β”‚       β”œβ”€β”€ template-repo-sync.yaml     # πŸ”„ Template repository sync workflow
β”‚       └── update-license.yml          # πŸ“„ License year update workflow
β”œβ”€β”€ .gitignore                          # 🚫 Files and directories to be ignored by Git
β”œβ”€β”€ .gitleaks.toml                      # πŸ”’ Gitleaks secret scanning configuration
β”œβ”€β”€ .pre-commit-config.yaml             # πŸ› οΈ Pre-commit hooks configuration
β”œβ”€β”€ .releaserc.json                     # πŸš€ Semantic release configuration
β”œβ”€β”€ .templatesyncignore                 # πŸ”„ Template sync ignore patterns
β”œβ”€β”€ .vscode                             # πŸ–₯️ VSCode-specific configurations
β”‚   β”œβ”€β”€ extensions.json                 # πŸ› οΈ Recommended extensions for VSCode
β”‚   └── settings.json                   # βš™οΈ VSCode settings
β”œβ”€β”€ .yamllint                           # πŸ“ YAML linting configuration
β”œβ”€β”€ CHANGELOG.md                        # πŸ“ Change log of the project
β”œβ”€β”€ CODEOWNERS                          # πŸ‘₯ Defines the code owners for the repository
β”œβ”€β”€ LICENSE                             # βš–οΈ License for the project
└── README.md                           # πŸ“– Project documentation (this file)

βš™οΈ Semantic Commit Messages

This project uses Semantic Commit Messages to ensure meaningful and consistent commit history. The format is as follows:

<type>(<scope>): <subject>

Types

  • feat: A new feature (e.g., feat: add login functionality).
  • fix: A bug fix (e.g., fix: resolve login button issue).
  • docs: Documentation changes (e.g., docs: update API documentation).
  • style: Code style changes (formatting, missing semi-colons, etc.) without changing logic (e.g., style: fix indentation).
  • refactor: Code changes that neither fix a bug nor add a feature (e.g., refactor: update user controller structure).
  • test: Adding or updating tests (e.g., test: add unit tests for login service).
  • chore: Changes to build process, auxiliary tools, or libraries (e.g., chore: update dependencies).

Scope

Optional: The part of the codebase affected by the change (e.g., feat(auth): add OAuth support)

Subject

A brief description of the change, using the imperative mood (e.g., fix: resolve issue with user authentication).

πŸ”’ Secret Scanning with Gitleaks

This project uses Gitleaks to detect secrets and sensitive information in the codebase. Gitleaks is configured to run both locally via pre-commit hooks and in CI/CD pipelines.

Local Development

Gitleaks runs automatically as a pre-commit hook. To install the pre-commit hooks:

pre-commit install

To run Gitleaks manually:

pre-commit run gitleaks --all-files

CI/CD Integration

Gitleaks runs automatically on:

  • Pull requests to main/master branch
  • Pushes to main/master branch

The workflow will fail if any secrets are detected, helping prevent accidental exposure of sensitive information.

Configuration

The .gitleaks.toml file contains:

  • Allowlist patterns for false positives
  • Custom scanning rules
  • Output configuration

πŸ” CodeQL Security Analysis

This project uses GitHub CodeQL to perform advanced security analysis and detect vulnerabilities in the codebase. CodeQL is configured to analyze JavaScript and Python code by default.

When It Runs

CodeQL analysis runs automatically on:

  • Pull requests to main/master branch
  • Pushes to main/master branch
  • Weekly schedule (every Monday at 00:00 UTC)

Language Detection

The workflow is configured with continue-on-error: true, which means:

  • If a specified language (JavaScript or Python) is not detected in the repository, the workflow will not fail
  • This is useful for template repositories where different projects may use different languages
  • Analysis will still run for any languages that are present

Customization

To customize the languages analyzed, edit .github/workflows/codeql.yaml:

matrix:
  language: [ 'javascript', 'python' ]
  # Supported: 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby', 'swift'

Security Alerts

Security vulnerabilities detected by CodeQL are reported in the Security tab of your repository under "Code scanning alerts".

πŸš€ Semantic Release

How It Works

  1. Analyze commits: Semantic Release inspects commit messages to determine the type of changes in the codebase.
  2. Generate release version: Based on the commit type, it will automatically bump the version following semantic versioning:
    • fix β†’ Patch release (e.g., 1.0.1)
    • feat β†’ Minor release (e.g., 1.1.0)
    • BREAKING CHANGE β†’ Major release (e.g., 2.0.0)
  3. Create release notes: It generates a changelog from the commit messages and includes it in the release.
  4. Publish: It automatically publishes the new version to the repository (and any other configured registries, e.g., npm).

🀝 Contributing

If you find any issues or have suggestions for improving this template repository, please feel free to open an issue or submit a pull request. Contributions are always welcome!

πŸ“œ License

This repository is licensed under the MIT License. See the LICENSE file for more information.

About

A template repository with GitHub best practices, CI/CD workflows, and security configurations

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors