Skip to content

Commit

Permalink
feat: Added git repo actions (#1)
Browse files Browse the repository at this point in the history
* added git repo actions
  • Loading branch information
diegolagospagopa committed Feb 19, 2024
1 parent 179a20f commit fdea5fc
Show file tree
Hide file tree
Showing 7 changed files with 201 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<!--- Please always add a PR description as if nobody knows anything about the context these changes come from. -->
<!--- Even if we are all from our internal team, we may not be on the same page. -->
<!--- Write this PR as you were contributing to a public OSS project, where nobody knows you and you have to earn their trust. -->
<!--- This will improve our projects in the long run! Thanks. -->

### List of changes

<!--- Describe your changes in detail -->

### Motivation and context

<!--- Why is this change required? What problem does it solve? -->

### Type of changes

- [ ] Add new resources
- [ ] Update configuration to existing resources
- [ ] Remove existing resources
- [ ] Other

### Env to apply

- [x] DEV

### Does this introduce a change to production resources with possible user impact?

- [ ] Yes, users may be impacted applying this change
- [ ] No

### Does this introduce an unwanted change on infrastructure? Check terraform plan execution result

- [ ] Yes
- [ ] No

### Other information

<!-- Any other information that is important to this PR such as screenshots of how the component looks before and after the change. -->

---

### If PR is partially applied, why? (reserved to mantainers)

<!--- Describe the blocking cause -->
38 changes: 38 additions & 0 deletions .github/workflows/check_helm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: check_helm

on:
push:

jobs:
check_helm:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: setup_python
uses: actions/setup-python@v2

- name: setup_pip
run: |
python -m ensurepip --upgrade
- name: setup_checkcov
run: |
python -m pip install -U checkov
- name: setup_helm
run: |
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
chmod 700 get_helm.sh
./get_helm.sh
- name: run_checkov
run: |
FILE=./util/values.checkov.yaml
if [ -f "${FILE}" ]; then
checkov -d src --var-file "${FILE}" --framework helm
else
echo "${FILE} does not exist."
exit 0
fi
55 changes: 55 additions & 0 deletions .github/workflows/pr-title.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: "Validate PR title"

on:
pull_request_target:
types:
- opened
- edited
- synchronize

jobs:
main:
name: Validate PR title
runs-on: ubuntu-latest
steps:
# Please look up the latest version from
# https://github.com/amannn/action-semantic-pull-request/releases
- uses: amannn/action-semantic-pull-request@v3.4.6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
# Configure which types are allowed.
# Default: https://github.com/commitizen/conventional-commit-types
types: |
fix
feat
docs
chore
breaking
# Configure that a scope must always be provided.
requireScope: false
# Configure additional validation for the subject based on a regex.
# This example ensures the subject starts with an uppercase character.
subjectPattern: ^.+$
# If `subjectPattern` is configured, you can use this property to override
# the default error message that is shown when the pattern doesn't match.
# The variables `subject` and `title` can be used within the message.
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.
# For work-in-progress PRs you can typically use draft pull requests
# from Github. However, private repositories on the free plan don't have
# this option and therefore this action allows you to opt-in to using the
# special "[WIP]" prefix to indicate this state. This will avoid the
# validation of the PR title and the pull request checks remain pending.
# Note that a second check will be reported if this is enabled.
wip: true
# When using "Squash and merge" on a PR with only one commit, GitHub
# will suggest using that commit message instead of the PR title for the
# merge commit, and it's easy to commit this by mistake. Enable this option
# to also validate the commit message for one commit PRs.
validateSingleCommit: false
# Related to `validateSingleCommit` you can opt-in to validate that the PR
# title matches a single commit to avoid confusion.
validateSingleCommitMatchesPrTitle: false
33 changes: 33 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Release

on:
# Trigger the workflow on push or pull request,
# but only for the main branch
push:
branches:
- main
paths-ignore:
- "CODEOWNERS"
- "**.md"
- ".**"

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

- name: Release
uses: cycjimmy/semantic-release-action@v2
with:
semantic_version: 18.0.0
extra_plugins: |
@semantic-release/release-notes-generator@10.0.3
@semantic-release/git@10.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.DS_Store
12 changes: 12 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
repos:
- repo: https://github.com/norwoodj/helm-docs
rev: v1.11.3
hooks:
- id: helm-docs
args:
# Make the tool search for charts only under the `example-charts` directory
- --chart-search-root=charts/microservice-chart
- repo: https://github.com/gruntwork-io/pre-commit
rev: v0.1.23 # Get the latest from: https://github.com/gruntwork-io/pre-commit/releases
hooks:
- id: helmlint
19 changes: 19 additions & 0 deletions .releaserc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
module.exports = {
branches: ["main", "master"],
ci: false,
tagFormat: "microservice-chart-${version}",
plugins: [
[
"@semantic-release/commit-analyzer",
{
preset: "angular",
releaseRules: [
{ type: "breaking", release: "major" },
{ type: "major", release: "major" },
],
},
],
"@semantic-release/release-notes-generator",
"@semantic-release/github",
],
};

0 comments on commit fdea5fc

Please sign in to comment.