Skip to content

Commit 539d596

Browse files
committed
init
1 parent ec61754 commit 539d596

File tree

4 files changed

+120
-0
lines changed

4 files changed

+120
-0
lines changed

README.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# ccc-actions - GitHub Actions for [Cloud Cost Checker](https://github.com/kunitsuinc/ccc)
2+
3+
[ccc - Cloud Cost Checker](https://github.com/kunitsuinc/ccc) collects, calculates, graphs and notifies IaaS costs.
4+
5+
## Example
6+
7+
`vim .github/workflows/ccc.yml`
8+
9+
```yml
10+
name: 'ccc - Cloud Cost Checker'
11+
12+
on:
13+
schedule:
14+
- cron: '0 1 * * *'
15+
workflow_dispatch:
16+
branches:
17+
- main
18+
inputs: {}
19+
20+
jobs:
21+
should-gitignore:
22+
name: 'Run ccc - Cloud Cost Checker'
23+
runs-on: ubuntu-latest
24+
timeout-minutes: 10
25+
permissions:
26+
id-token: write
27+
steps:
28+
- name: 'Authenticate to Google Cloud'
29+
# NOTE: cf. https://github.com/google-github-actions/auth
30+
uses: 'google-github-actions/auth@v0.8.1'
31+
with:
32+
workload_identity_provider: 'projects/999999999999/locations/global/workloadIdentityPools/your-pool/providers/your-provider'
33+
service_account: 'ccc@your-gcp-project.iam.gserviceaccount.com'
34+
access_token_lifetime: '600s'
35+
- uses: kunitsuinc/ccc-actions@v0.0.4
36+
with:
37+
TZ: 'Asia/Tokyo'
38+
GOOGLE_CLOUD_PROJECT: 'your-gcp-project'
39+
GCP_BILLING_TABLE: '${{ secrets.CCC_GCP_BILLING_TABLE }}'
40+
GCP_BILLING_PROJECT: 'your-gcp-project'
41+
DAYS: '30'
42+
IMAGE_FORMAT: 'png'
43+
MESSAGE: "'```your-gcp-project Cost```'"
44+
SLACK_TOKEN: '${{ secrets.CCC_SLACK_TOKEN }}'
45+
SLACK_CHANNEL: '#your-bot-invited-channel'
46+
DEBUG: 'true'
47+
```

action.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# cf. Creating a composite action - GitHub Docs https://docs.github.com/en/actions/creating-actions/creating-a-composite-action
2+
# cf. Metadata syntax for GitHub Actions - GitHub Docs https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#runs-for-composite-actions
3+
4+
name: ccc-actions
5+
description: Run ccc - Cloud Cost Checker https://github.com/kunitsuinc/ccc
6+
author: 'kunitsuinc'
7+
8+
branding:
9+
icon: search
10+
color: gray-dark
11+
12+
inputs:
13+
VERSION:
14+
description: 'ccc version for workflow (default "latest")'
15+
required: false
16+
default: 'latest'
17+
TZ:
18+
description: 'Time Zone for BigQuery (default "UTC")'
19+
required: false
20+
default: 'UTC'
21+
GOOGLE_CLOUD_PROJECT:
22+
description: 'Google Cloud Project ID'
23+
required: true
24+
GCP_BILLING_TABLE:
25+
description: 'GCP Billing export BigQuery Table name like: project-id.dataset_id.gcp_billing_export_v1_FFFFFF_FFFFFF_FFFFFF'
26+
required: true
27+
GCP_BILLING_PROJECT:
28+
description: 'Project ID in GCP Billing export BigQuery Table'
29+
required: true
30+
DAYS:
31+
description: 'Days for BigQuery (default 30)'
32+
required: false
33+
default: '30'
34+
IMAGE_FORMAT:
35+
description: 'Image Format (default "png")'
36+
required: false
37+
default: 'png'
38+
MESSAGE:
39+
description: 'Slack Message (Quoted)'
40+
required: false
41+
default: ''
42+
SLACK_TOKEN:
43+
description: 'Slack OAuth Token like: xoxb-999999999999-9999999999999-ZZZZZZZZZZZZZZZZZZZZZZZZ'
44+
required: true
45+
SLACK_CHANNEL:
46+
description: 'Slack Channel name (Bot must have already been invited)'
47+
required: true
48+
DEBUG:
49+
description: 'Debug flag'
50+
required: false
51+
default: 'false'
52+
53+
runs:
54+
using: 'composite'
55+
steps:
56+
- name: Run ccc - Cloud Cost Checker
57+
shell: 'bash'
58+
env:
59+
DEBUG: ${{ inputs.DEBUG }}
60+
TZ: ${{ inputs.TZ }}
61+
GOOGLE_CLOUD_PROJECT: ${{ inputs.GOOGLE_CLOUD_PROJECT }}
62+
GCP_BILLING_TABLE: ${{ inputs.GCP_BILLING_TABLE }}
63+
GCP_BILLING_PROJECT: ${{ inputs.GCP_BILLING_PROJECT }}
64+
DAYS: ${{ inputs.DAYS }}
65+
IMAGE_FORMAT: ${{ inputs.IMAGE_FORMAT }}
66+
MESSAGE: ${{ inputs.MESSAGE }}
67+
SLACK_TOKEN: ${{ inputs.SLACK_TOKEN }}
68+
SLACK_CHANNEL: ${{ inputs.SLACK_CHANNEL }}
69+
run: |
70+
set -x
71+
env
72+
${{ github.action_path }}/${{ inputs.VERSION }}/bin/ccc

latest

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v0.0.4

v0.0.4/bin/ccc

25.6 MB
Binary file not shown.

0 commit comments

Comments
 (0)