Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenquanheycar authored Mar 20, 2024
0 parents commit d8943e6
Show file tree
Hide file tree
Showing 14 changed files with 510 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @hey-car/infra
100 changes: 100 additions & 0 deletions .github/settings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
---
repository:
name: actions-template
description: |
A Github template repo for public Gh Actions
topics: github, actions, ci, scripts
default_branch: master

private: true
has_projects: false
has_wiki: false
has_downloads: false

allow_squash_merge: true
allow_merge_commit: false
allow_rebase_merge: false
delete_branch_on_merge: true

teams:
- name: infra
permission: admin

labels:
- name: "help wanted"
color: "#008672"
description: "Extra attention is needed"
- name: "priority: critical"
color: "#b60205"
description: ""
- name: "priority: high"
color: "#d93f0b"
description: ""
- name: "priority: low"
color: "#0e8a16"
description: ""
- name: "priority: medium"
color: "#fbca04"
description: ""
- name: "status: can't reproduce"
color: "#fec1c1"
description: ""
- name: "status: confirmed"
color: "#215cea"
description: ""
- name: "status: duplicate"
color: "#cfd3d7"
description: "This issue or pull request already exists"
- name: "status: needs information"
color: "#fef2c0"
description: ""
- name: "status: wont do/fix"
color: "#eeeeee"
description: "This will not be worked on"
- name: "type: bug"
color: "#d73a4a"
description: "Something isn't working"
- name: "type: discussion"
color: "#d4c5f9"
description: ""
- name: "type: documentation"
color: "#006b75"
description: ""
- name: "type: enhancement"
color: "#84b6eb"
description: ""
- name: "type: epic"
color: "#3E4B9E"
description: "A theme of work that contain sub-tasks"
- name: "type: feature request"
color: "#fbca04"
description: "New feature or request"
- name: "type: question"
color: "#d876e3"
description: "Further information is requested"

branches:
- name: master
protection:
required_pull_request_reviews:
required_approving_review_count: 2
dismiss_stale_reviews: true
require_code_owner_reviews: true
bypass_pull_request_allowances:
users:
- supcar
teams: []
apps: []
dismissal_restrictions:
users:
- supcar
teams: []
apps: []
required_status_checks: null
enforce_admins: true
required_linear_history: true
restrictions:
users:
- supcar
teams: []
apps: []
36 changes: 36 additions & 0 deletions .github/workflows/pr-title.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
name: Validate PR title

on:
pull_request:
types:
- opened
- synchronize
- edited
- ready_for_review

jobs:
validate:
name: Validate PR title
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5.4.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
types: |
fix
feat
docs
ci
chore
test
refactor
requireScope: false
subjectPattern: ^[A-z].+$
subjectPatternError: |
The subject "{subject}" found in the pull request title "{title}"
didn't match the configured pattern. Please ensure that the subject
starts with an uppercase character.
wip: true
validateSingleCommit: true
22 changes: 22 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Pre-Commit

on:
pull_request:
types:
- opened
- synchronize
- edited
- ready_for_review

jobs:
pre-commit:
name: Pre-Commit
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false
fetch-depth: 0
- name: Run pre-commit hooks
uses: pre-commit/action@v3.0.1
29 changes: 29 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
name: Release

on:
push:
branches:
- master

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false
fetch-depth: 0

- name: Release
uses: cycjimmy/semantic-release-action@v4
with:
semantic_version: 18.0.0
extra_plugins: |
@semantic-release/changelog@6.0.0
@semantic-release/git@10.0.0
conventional-changelog-conventionalcommits@4.6.3
env:
GITHUB_TOKEN: ${{ secrets.VERSIONING_TOKEN }}
37 changes: 37 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# General files for the project
pkg/*
*.pyc
bin/*
.project
/.bin
/_test/secrets/*.json

# OSX leaves these everywhere on SMB shares
._*

# OSX trash
.DS_Store

# Files generated by JetBrains IDEs, e.g. IntelliJ IDEA
.idea/
*.iml

# Vscode files
.vscode

# Emacs save files
*~
\#*\#
.\#*

# Vim-related files
[._]*.s[a-w][a-z]
[._]s[a-w][a-z]
*.un~
Session.vim
.netrwhist

# Chart dependencies
**/charts/*.tgz

.history
19 changes: 19 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: check-yaml
- id: check-merge-conflict
- id: end-of-file-fixer
- repo: https://github.com/hadolint/hadolint
rev: v2.12.0
hooks:
- id: hadolint-docker
args:
- --failure-threshold
- warning
- repo: https://github.com/gitleaks/gitleaks
rev: v8.16.1
hooks:
- id: gitleaks
44 changes: 44 additions & 0 deletions .releaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"branches": [
"main",
"master"
],
"plugins": [
[
"@semantic-release/commit-analyzer",
{
"preset": "conventionalcommits"
}
],
[
"@semantic-release/release-notes-generator",
{
"preset": "conventionalcommits"
}
],
[
"@semantic-release/github",
{
"successComment": "This ${issue.pull_request ? 'PR is included' : 'issue has been resolved'} in version ${nextRelease.version} :tada:",
"labels": false,
"releasedLabels": false
}
],
[
"@semantic-release/changelog",
{
"changelogFile": "CHANGELOG.md",
"changelogTitle": "# Changelog\n\nAll notable changes to this project will be documented in this file."
}
],
[
"@semantic-release/git",
{
"assets": [
"CHANGELOG.md"
],
"message": "chore(release): version ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}
]
]
}
23 changes: 23 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Contributing

## Local setup for pre-commit hooks

- [pre-commit](https://pre-commit.com/#install)

To test hooks before commiting, you can run `pre-commit run -a`.

## Commit guidelines

To generate changelog, Pull Requests and Commits must have semantic and must follow conventional specs below:

- `feat()!:` for breaking changes (major release)
- `feat():` for new features (minor release)
- `fix():` for bug fixes (patch release)
- `docs():` for documentation and examples (no release)
- `refactor():` for code refactoring (no release)
- `test():` for tests (no release)
- `ci():` for CI purpose (no release)
- `chore():` for chores stuff (no release)

The `chore` prefix skipped during changelog generation. It can be used for `chore: update changelog` commit message by
example.
21 changes: 21 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
ARG ALPINE_VERSION="3.19"

ARG BASH_VERSION="5.2.26-r0"

FROM alpine:${ALPINE_VERSION}

WORKDIR /scripts

RUN apk update --no-cache; \
apk upgrade --no-cache; \
apk add --no-cache bash=${BASH_VERSION}; \
rm -rf /var/cache/apk/*

ENV LOG_LEVEL "INFO"
ENV LOG_TIMESTAMPED "true"
ENV DEBUG_MODE "false"

COPY scripts/utils.sh .
COPY scripts/script.sh .

ENTRYPOINT ["/scripts/script.sh"]
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# actions-template

Template repo for github actions
39 changes: 39 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Some action # TODO(user): Replace this with your action name
branding:
icon: arrow-right-circle
color: gray-dark
description: | # TODO(user): replace this with your action description
This action does something
inputs:
debug-mode:
description: Set to true for verbose execution when debugging
required: false
default: 'false'
log-level:
description: The log level to use for the execution
required: false
default: 'info'
log-timestamped:
description: Set to true in order to enable timestamps on log messages
required: false
default: 'true'
# TODO(user): Specify your inputs here
input-name:
description: Some input description
required: true

# TODO(user): Define your outputs here
outputs:
some-output:
description: 'Some output description'

runs:
using: 'docker'
image: Dockerfile
env:
DEBUG_MODE: ${{ inputs.debug-mode }}
LOG_LEVEL: ${{ inputs.log-level }}
LOG_TIMESTAMPED: ${{ inputs.log-timestamped }}
# TODO(user): Define your environment variables here
SOME_INPUT: ${{ inputs.input-name }}
Loading

0 comments on commit d8943e6

Please sign in to comment.