-
Notifications
You must be signed in to change notification settings - Fork 10
78 lines (68 loc) · 2.33 KB
/
update-rules.yaml
File metadata and controls
78 lines (68 loc) · 2.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
name: Update Config Rules
on:
schedule:
- cron: '0 0 1,15 * *'
workflow_dispatch:
permissions:
contents: write
pull-requests: write
jobs:
update-rules:
name: Update Rules
runs-on: ubuntu-latest
outputs:
any_changed: ${{ steps.changed-files.outputs.any_changed }}
pull_request_operation: ${{ steps.create-pull-request.outputs.pull-request-operation }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: 1.14.3
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: scripts/go/go.mod
- name: Update rules
id: update-rules
run: |
go build -C scripts/go -o generator ./cmd/generator
./scripts/go/generator update-config-rules
./scripts/go/generator update-rule-packs
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@2f7c5bfce28377bc069a65ba478de0a74aa0ca32 # v46.0.1
with:
files: |
"*.tf"
"files/*"
- name: List all changed files
run: echo '${{ steps.changed-files.outputs.all_changed_files }}'
- name: Create Pull Request
id: create-pull-request
if: steps.changed-files.outputs.any_changed == 'true'
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
base: main
branch: auto-update-aws-config-rules
add-paths: |
managed_rules_*.tf
files/*
commit-message: Automatic updates to AWS managed Config Rules
delete-branch: true
title: '[Auto] Update AWS Config Rules'
body: |
Update the list of AWS managed Config Rules using the [latest documentation](https://docs.aws.amazon.com/config/latest/developerguide/managed-rules-by-aws-config.html).
assignees: bensonce
reviewers: bensonce,duraikkannuv2
terraform-checks:
name: Terraform Checks
needs: update-rules
if: needs.update-rules.outputs.pull_request_operation != ''
uses: ./.github/workflows/terraform-checks.yaml
with:
ref: auto-update-aws-config-rules
push_branch: auto-update-aws-config-rules
secrets: inherit