kdocs
GitHub
Lang - General
Lang - General
  • Code Versioning
    • Git
      • Configurations
      • Conventional Commit
      • Workflows
    • GitHub
      • Git Actions
    • GitOps
    • SemVer
  • Tests
    • Jest
Powered by GitBook
On this page
  • Rest API
  • Repository Configurations
  • Deafult branch
  • Configure Pull Requests
  • Added Rulesets
  • Pull Request Templates
  • Codeowners
  • Releases
  1. Code Versioning

GitHub

PreviousWorkflowsNextGit Actions

Last updated 3 months ago

Rest API

GitHub offers a Rest API, check documentation .

Repository Configurations

Following a workflow, it is good practice make some configurations.

Deafult branch

Change the repository default branch to develop, inside project's settings.

Configure Pull Requests

Configure Pull Requests on project's settings to ONLY squash commits on merge. Disable the others.

Added

Inside the project's settings "Branch protection rules".

main and develop

Add restriction rules on the main branch, so that code is not commited or pushed directly on it, but only pushed with Pull Requests.

ruleset-name: gitflow-main-branches-restrictions
bypass-list:
  - repo_admins
target-branches:
  - main
  - develop
branch-rules:
  - restrict_creation
  - restrict_updates
  - restrict_deletions
  - require_linear_history
  - require_signed_commits
  - require_pr_before_merging
    - dismiss_stale_pr_approvals_after_new_commits
    - require_conversation_resolution_before_merging
    - allow_merge_methods
      - squash
  - require_status_check_pass
    - require_branches_to_be_update_before_merging
  - block_force_pushes

feature

ruleset-name: gitflow-feature-branch-restrictions
target-branches:
  - feature/**/*
branch-rules:
  - require_signed_commits
  - block_force_pushes

release

ruleset-name: gitflow-release-branch-restrictions
target-branches:
  - release/**/*
branch-rules:
  - require_signed_commits
  - block_force_pushes

hotfix

ruleset-name: gitflow-hotfix-branch-restrictions
target-branches:
  - hotfix/**/*
branch-rules:
  - require_signed_commits
  - block_force_pushes

Pull Request Templates

Create a template inside the projects folder at /.github/PULL_REQUEST_TEMPLATE.md.

Ideal to create at Repository start.

Codeowners

You can use this functionality to specify users as owners of folders, file, extensions, etc inside the project.

This will make them automatically a required Reviewer for PRs on these files.

To add Codeowners add this file to the project's .github folder.

/.github/CODEOWNERS
*.js @username
/src/sectionA @user2 @group-A
spec.go @group-B

Releases

here
Rulesets
Gitflow