Skip to content

Commit cfc8309

Browse files
committed
Add GitHub actions
1 parent a332e74 commit cfc8309

File tree

6 files changed

+260
-0
lines changed

6 files changed

+260
-0
lines changed

.github/labeler.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Modules
2+
":floppy_disk: org-organization":
3+
- modules/org-organization/**/*
4+
":floppy_disk: org-team":
5+
- modules/org-team/**/*
6+
":floppy_disk: project":
7+
- modules/project/**/*
8+
":floppy_disk: repository":
9+
- modules/repository/**/*
10+
":floppy_disk: webhook":
11+
- modules/webhook/**/*

.github/labels.yaml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Warning
2+
- color: "ee0701"
3+
description: "Categorize bug reports."
4+
name: ":warning: bug"
5+
- color: "ee0701"
6+
description: "Categorize vulnerability reports."
7+
name: ":warning: vulnerability"
8+
9+
# Highlight
10+
- color: "0e8a16"
11+
description: "Good for newcomers."
12+
name: ":fire: good first issue"
13+
- color: "0e8a16"
14+
description: "Extra attention is needed."
15+
name: ":fire: help wanted"
16+
17+
# Cancel
18+
- color: "b60205"
19+
description: "This issue or pull request already exists."
20+
name: ":pray: duplicate"
21+
- color: "b60205"
22+
description: "This will not be worked on."
23+
name: ":pray: wontfix"
24+
25+
# Size
26+
- color: "cfd3d7"
27+
description: "Extra Small size issue or PR."
28+
name: "size/XS"
29+
- color: "cfd3d7"
30+
description: "Small size issue or PR."
31+
name: "size/S"
32+
- color: "cfd3d7"
33+
description: "Medium size issue or PR."
34+
name: "size/M"
35+
- color: "cfd3d7"
36+
description: "Large size issue or PR."
37+
name: "size/L"
38+
- color: "cfd3d7"
39+
description: "Extra Large size issue or PR."
40+
name: "size/XL"
41+
42+
# Modules
43+
- color: "fbca04"
44+
description: "This issue or pull request is related to org-organization module."
45+
name: ":floppy_disk: org-organization"
46+
- color: "fbca04"
47+
description: "This issue or pull request is related to org-team module."
48+
name: ":floppy_disk: org-team"
49+
- color: "fbca04"
50+
description: "This issue or pull request is related to project module."
51+
name: ":floppy_disk: project"
52+
- color: "fbca04"
53+
description: "This issue or pull request is related to repository module."
54+
name: ":floppy_disk: repository"
55+
- color: "fbca04"
56+
description: "This issue or pull request is related to webhook module."
57+
name: ":floppy_disk: webhook"

.github/workflows/integration.yaml

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
name: Integration
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request: {}
8+
9+
concurrency:
10+
group: integration-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
changed:
15+
runs-on: ubuntu-latest
16+
17+
outputs:
18+
terraform_modules_changed: ${{ steps.filter-terraform-modules.outputs.changed }}
19+
terraform_modules_files: ${{ steps.filter-terraform-modules.outputs.files }}
20+
terraform_modules_dirs: ${{ steps.filter-terraform-modules.outputs.dirs }}
21+
yaml_changed: ${{ steps.filter-yaml.outputs.changed }}
22+
yaml_files: ${{ steps.filter-yaml.outputs.files }}
23+
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v2
27+
with:
28+
fetch-depth: 0
29+
30+
- name: Get Changed Files
31+
id: changed-files
32+
uses: dorny/paths-filter@v2
33+
with:
34+
list-files: json
35+
filters: |
36+
modules:
37+
- 'modules/**'
38+
yaml:
39+
- '**/*.yaml'
40+
- '**/*.yml'
41+
42+
- name: Filter changed Terraform Modules files to outputs
43+
id: filter-terraform-modules
44+
run: |
45+
dirs=$(echo '${{ steps.changed-files.outputs.modules_files }}' | jq '[.[] | match("modules/[^/]+").string] | unique')
46+
echo ::set-output name=changed::${{ steps.changed-files.outputs.modules }}
47+
echo ::set-output name=files::${{ steps.changed-files.outputs.modules_files }}
48+
echo ::set-output name=dirs::$dirs
49+
50+
- name: Filter changed YAML files to outputs
51+
id: filter-yaml
52+
run: |
53+
echo ::set-output name=changed::${{ steps.changed-files.outputs.yaml }}
54+
echo ::set-output name=files::${{ steps.changed-files.outputs.yaml_files }}
55+
56+
57+
terraform:
58+
needs:
59+
- changed
60+
if: ${{ needs.changed.outputs.terraform_modules_changed != 'false' }}
61+
runs-on: ubuntu-latest
62+
63+
strategy:
64+
matrix:
65+
path: ${{ fromJson(needs.changed.outputs.terraform_modules_dirs) }}
66+
67+
steps:
68+
- name: Checkout
69+
uses: actions/checkout@v2
70+
71+
- name: Set-up terraform
72+
uses: hashicorp/setup-terraform@v1
73+
74+
- name: Terraform fmt
75+
id: terraform-fmt
76+
working-directory: ${{ matrix.path }}
77+
run: terraform fmt -check
78+
continue-on-error: true
79+
80+
- name: Terraform Validate
81+
id: terraform-validate
82+
working-directory: ${{ matrix.path }}
83+
run: |
84+
terraform init -backend=false
85+
terraform validate -no-color
86+
87+
88+
yaml:
89+
needs:
90+
- changed
91+
if: ${{ needs.changed.outputs.yaml_changed != 'false' }}
92+
runs-on: ubuntu-latest
93+
94+
steps:
95+
- name: Checkout
96+
uses: actions/checkout@v2
97+
98+
- name: Lint YAML Files
99+
id: yaml-lint
100+
run: |
101+
yamllint .
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Label Pull Requests
2+
3+
on:
4+
- pull_request_target
5+
6+
jobs:
7+
label-pr:
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- name: Add Labels for PR
12+
uses: actions/labeler@v3
13+
with:
14+
repo-token: "${{ secrets.GITHUB_TOKEN }}"
15+
configuration-path: .github/labeler.yaml
16+
sync-labels: true
17+
18+
- name: Add PR Size Labels for PR
19+
uses: codelytv/pr-size-labeler@v1
20+
with:
21+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
22+
xs_label: 'size/XS'
23+
xs_max_size: '20'
24+
s_label: 'size/S'
25+
s_max_size: '50'
26+
m_label: 'size/M'
27+
m_max_size: '150'
28+
l_label: 'size/L'
29+
l_max_size: '300'
30+
xl_label: 'size/XL'
31+
fail_if_xl: 'false'
32+
message_if_xl: >
33+
'This PR has too many changes.
34+
Please make sure you are NOT addressing multiple issues with one PR.'

.github/workflows/sync-labels.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Sync labels
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- .github/labels.yaml
9+
workflow_dispatch: {}
10+
11+
jobs:
12+
sync-labels:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v2
18+
19+
- name: Sync labels
20+
uses: crazy-max/ghaction-github-labeler@v3
21+
with:
22+
github-token: ${{ secrets.GITHUB_TOKEN }}
23+
yaml-file: .github/labels.yaml
24+
skip-delete: false
25+
dry-run: false
26+
# exclude: |

.github/workflows/welcome.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Welcome for First Issue or Pull Request
2+
3+
on:
4+
pull_request_target:
5+
types:
6+
- opened
7+
issues:
8+
types:
9+
- opened
10+
11+
jobs:
12+
welcome:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Welcome for First Issue or Pull Request
17+
uses: actions/first-interaction@v1
18+
with:
19+
repo-token: ${{ secrets.GITHUB_TOKEN }}
20+
issue-message: |
21+
### :wave: Welcome! Looks like this is your first issue.
22+
23+
Hey, thanks for your contribution! Please give us a bit of time to review it. 😄
24+
25+
**Be sure to follow the issue template!**
26+
pr-message: |
27+
### :wave: Welcome! Looks like this is your first pull request.
28+
29+
Hey, thanks for your contribution! Please give us a bit of time to review it. 😄
30+
31+
**Please check out our contributing guidelines.**

0 commit comments

Comments
 (0)