Skip to content

Commit e90bde8

Browse files
committed
feat: initial commit
0 parents  commit e90bde8

File tree

12 files changed

+379
-0
lines changed

12 files changed

+379
-0
lines changed

.cz.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
commitizen:
3+
gpg_sign: true
4+
major_version_zero: true
5+
name: cz_conventional_commits
6+
tag_format: v$version
7+
update_changelog_on_bump: true
8+
version: 0.0.0
9+
version_files:
10+
- README.md
11+
version_scheme: semver

.editorconfig

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# EditorConfig is awesome: https://EditorConfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
[*]
7+
indent_style = space
8+
indent_size = 4
9+
end_of_line = lf
10+
charset = utf-8
11+
trim_trailing_whitespace = true
12+
insert_final_newline = true
13+
14+
[{*.md,*.yaml,*.yml}]
15+
indent_style = space
16+
indent_size = 2
17+
x-soft-wrap-text = true

.github/dependabot.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: 2
2+
updates:
3+
# Maintain dependencies for GitHub Actions
4+
- package-ecosystem: "github-actions"
5+
directory: "/"
6+
schedule:
7+
interval: "weekly"
8+
labels: ["dependencies"]
9+
commit-message:
10+
prefix: "ci(gh)"

.github/workflows/ci.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: ci
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- coatl
8+
workflow_dispatch:
9+
10+
jobs:
11+
pre-commit:
12+
uses: coatl-dev/workflows/.github/workflows/pre-commit.yml@v1
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: test-gpg-import
2+
3+
on:
4+
push:
5+
branches:
6+
- coatl
7+
paths:
8+
- 'gpg-import/action.yaml'
9+
pull_request:
10+
paths:
11+
- 'gpg-import/action.yaml'
12+
workflow_dispatch:
13+
14+
jobs:
15+
self-test:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout repo
19+
uses: actions/checkout@v4
20+
21+
- name: Import GPG
22+
uses: ./gpg-import
23+
id: gpg-import
24+
with:
25+
passphrase: ${{ secrets.COATL_BOT_GPG_PASSPHRASE }}
26+
private-key: ${{ secrets.COATL_BOT_GPG_PRIVATE_KEY }}
27+
28+
- name: Show Output
29+
run: |
30+
echo "git user.email: ${{ steps.gpg-import.outputs.git-user-email }}"
31+
echo "git user.name: ${{ steps.gpg-import.outputs.git-user-name }}"
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: test-simple-git-diff
2+
3+
on:
4+
push:
5+
branches:
6+
- coatl
7+
paths:
8+
- 'simple-git-diff/action.yaml'
9+
pull_request:
10+
paths:
11+
- 'simple-git-diff/action.yaml'
12+
workflow_dispatch:
13+
14+
jobs:
15+
test-true:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout repo
19+
uses: actions/checkout@v4
20+
21+
- name: Modify file in repo
22+
run: |
23+
echo "New line" >> README.md
24+
25+
- name: Detect changes
26+
id: git-diff
27+
uses: ./simple-git-diff
28+
with:
29+
file-or-path: 'README.md'
30+
31+
- name: Test true
32+
if: ${{ steps.git-diff.outputs.diff == 'true' }}
33+
run: |
34+
echo "Changes were detected."
35+
36+
test-false:
37+
runs-on: ubuntu-latest
38+
needs: test-true
39+
steps:
40+
- name: Checkout repo
41+
uses: actions/checkout@v4
42+
43+
- name: Detect changes
44+
id: git-diff
45+
uses: ./simple-git-diff
46+
47+
- name: Test false
48+
if: ${{ steps.git-diff.outputs.diff != 'true' }}
49+
run: |
50+
echo "Changes were not detected."

.pre-commit-config.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# See https://pre-commit.com for more information
2+
# See https://pre-commit.com/hooks.html for more hooks
3+
repos:
4+
- repo: https://github.com/pre-commit/pre-commit-hooks
5+
rev: v4.5.0
6+
hooks:
7+
- id: check-yaml
8+
- id: end-of-file-fixer
9+
- id: trailing-whitespace
10+
- repo: https://github.com/python-jsonschema/check-jsonschema
11+
rev: 0.27.0
12+
hooks:
13+
- id: check-github-workflows
14+
- id: check-jsonschema
15+
name: "Validate GitHub Actions"
16+
files: ^.*/action\.(yaml|yml)$
17+
types: [yaml]
18+
args: ["--builtin-schema", "vendor.github-actions", "--verbose"]
19+
- repo: https://github.com/commitizen-tools/commitizen
20+
rev: 3.10.0
21+
hooks:
22+
- id: commitizen
23+
- id: commitizen-branch
24+
stages:
25+
- push

CHANGELOG.md

Whitespace-only changes.

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2023 coatl.dev
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
# coatl-dev GitHub Actions
2+
3+
[![ci](https://github.com/coatl-dev/actions/actions/workflows/ci.yaml/badge.svg)](https://github.com/coatl-dev/actions/actions/workflows/ci.yaml)
4+
5+
A collection of custom GitHub Actions that are used to simplify our pipelines
6+
in projects to keep them DRY.
7+
8+
## Catalog
9+
10+
PLACEHOLDER
11+
12+
### gpg-import
13+
14+
GitHub Action to import GPG private key.
15+
16+
#### Inputs
17+
18+
- `config-git` (`string`): Whether to config Git to sign commits with the
19+
information obtained from GPG. Options: `'yes'`, `'no'`. Defaults to `'yes'`.
20+
Optional.
21+
- `passphrase` (`secret`): GPG private key passphrase. Required.
22+
- `private-key` (`secret`): GPG private key exported as an ASCII
23+
armored version. Required.
24+
25+
#### Outputs
26+
27+
- `git-user-email` (`string`): Email address used for setting up Git identity.
28+
- `git-user-name` (`string`): Name used for setting up Git identity.
29+
- `gpg-key-id` (`string`): The long form of the GPG key ID.
30+
31+
**Example**:
32+
33+
```yml
34+
name: sign-commit
35+
36+
on:
37+
push:
38+
branches:
39+
- main
40+
41+
jobs:
42+
sign-commit:
43+
runs-on: ubuntu-latest
44+
steps:
45+
- name: Checkout repo
46+
uses: actions/checkout@v4
47+
48+
- name: Import GPG key
49+
id: gpg-import
50+
uses: coatl-dev/actions/[email protected]
51+
with:
52+
passphrase: ${{ secrets.GPG_PASSPHRASE }}
53+
private-key: ${{ secrets.GPG_PRIVATE_KEY }}
54+
55+
- name: Sign commit and push changes
56+
run: |
57+
echo foo > bar.txt
58+
git add .
59+
git commit -S -m "This commit is signed!"
60+
git push
61+
```
62+
63+
### simple-git-diff
64+
65+
Run git diff on a file or path.
66+
67+
#### Inputs
68+
69+
- `file-or-path` (`string`): File or path to check for changes. Defaults to
70+
`'.'`. Optional.
71+
72+
#### Outputs
73+
74+
- `diff` (`string`): Whether files were changed between commits. Returns:
75+
`'true'` or `'false'`.
76+
77+
**Example**:
78+
79+
```yml
80+
name: git-diff
81+
82+
on:
83+
push:
84+
branches:
85+
- main
86+
87+
jobs:
88+
sign-commit:
89+
runs-on: ubuntu-latest
90+
steps:
91+
- name: Checkout repo
92+
uses: actions/checkout@v4
93+
94+
- name: Modify file in repo
95+
run: |
96+
echo "New line" >> README.md
97+
98+
- name: Detect changes
99+
id: git-diff
100+
uses: coatl-dev/actions/[email protected]
101+
with:
102+
file-or-path: 'README.md'
103+
104+
- name: Sign commit and push changes
105+
if: ${{ steps.git-diff.outputs.diff == 'true' }}
106+
run: |
107+
echo "Changes were detected."
108+
```

0 commit comments

Comments
 (0)