Skip to content

Commit c7c2ee7

Browse files
authored
Merge pull request #16 from badsyntax/kebab-case
Use kebab-case for input names
2 parents 9ba155d + 44304d9 commit c7c2ee7

File tree

7 files changed

+61
-66
lines changed

7 files changed

+61
-66
lines changed

.github/workflows/deploy.yml

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -28,53 +28,52 @@ jobs:
2828
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
2929
aws-region: us-east-1
3030

31-
- uses: badsyntax/[email protected].3
31+
- uses: badsyntax/[email protected].5
3232
name: Update CloudFormation Stack
3333
id: update-stack
3434
with:
35-
githubToken: ${{ secrets.GITHUB_TOKEN }}
36-
stackName: 'badsyntax-github-action-example-aws-cloudfront'
35+
stack-name: 'badsyntax-github-action-example-aws-cloudfront'
3736
template: './cloudformation/s3-cloudfront.yml'
38-
applyChangeSet: ${{ github.event_name != 'repository_dispatch' }}
39-
awsRegion: 'us-east-1'
37+
apply-change-set: ${{ github.event_name != 'repository_dispatch' }}
38+
aws-region: 'us-east-1'
4039
parameters: |
4140
S3BucketName=badsyntax-github-action-example-aws-cloudfront-us-east-1&
4241
S3AllowedOrigins=https://cloudfront-action.richardwillis.info&
4342
CloudFrontRootHosts=cloudfront-action.richardwillis.info&
4443
CertificateARN=arn:aws:acm:us-east-1:008215002370:certificate/cfb34309-b9bb-4f63-9af3-51026b8107d6
4544
46-
- uses: badsyntax/[email protected].2
45+
- uses: badsyntax/[email protected].3
4746
name: Sync mutable HTML files to S3
4847
id: sync-html-s3
4948
with:
5049
bucket: ${{ steps.update-stack.outputs.S3BucketName }}
5150
action: 'sync'
52-
srcDir: './out'
53-
filesGlob: '**/*.html'
54-
awsRegion: 'us-east-1'
51+
src-dir: './out'
52+
files-glob: '**/*.html'
53+
aws-region: 'us-east-1'
5554
prefix: 'root'
56-
stripExtensionGlob: '**/**.html'
57-
cacheControl: 'public,max-age=0,s-maxage=31536000,must-revalidate'
55+
strip-extension-glob: '**/**.html'
56+
cache-control: 'public,max-age=0,s-maxage=31536000,must-revalidate'
5857

59-
- uses: badsyntax/[email protected].2
58+
- uses: badsyntax/[email protected].3
6059
name: Sync immutable files to S3
6160
id: sync-immutable-s3
6261
with:
6362
bucket: ${{ steps.update-stack.outputs.S3BucketName }}
6463
action: 'sync'
65-
srcDir: './out'
66-
filesGlob: 'css/**'
67-
awsRegion: 'us-east-1'
64+
src-dir: './out'
65+
files-glob: 'css/**'
66+
aws-region: 'us-east-1'
6867
prefix: 'root'
69-
cacheControl: 'public,max-age=31536000,immutable'
68+
cache-control: 'public,max-age=31536000,immutable'
7069

7170
- uses: ./
7271
name: Invalidate CloudFront Cache
7372
id: invalidate-cloudfront-cache
7473
with:
75-
distributionId: ${{ steps.update-stack.outputs.CFDistributionId }}
76-
awsRegion: 'us-east-1'
77-
originPrefix: 'root'
78-
invalidatePaths: ${{ steps.sync-html-s3.outputs.S3SyncedFiles }}
79-
defaultRootObject: 'index'
80-
includeOriginPrefix: true
74+
distribution-id: ${{ steps.update-stack.outputs.CFDistributionId }}
75+
aws-region: 'us-east-1'
76+
origin-prefix: 'root'
77+
invalidate-paths: ${{ steps.sync-html-s3.outputs.S3SyncedFiles }}
78+
default-root-object: 'index'
79+
include-origin-prefix: true

FEATURES.md

Lines changed: 0 additions & 4 deletions
This file was deleted.

README.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66

77
A GitHub Action to invalidate a list of CloudFront paths.
88

9-
The Action will generate a new list based on input options. This is especially helpful when you're piping in origin paths (eg from an S3 Action) that need to be transformed into absolute URL paths from root. You can also include origin prefixes to cache-bust URL's rewritten by Lambda's (in which case you need to invalidate both the `viewer-request` and rewritten URL's). A root slash `/` is added if a url matches the `defaultRootObject`.
9+
The Action will generate a new list based on input options. This is especially helpful when you're piping in origin paths (eg from an S3 Action) that need to be transformed into absolute URL paths from root. You can also include origin prefixes to cache-bust URL's rewritten by Lambda's (in which case you need to invalidate both the `viewer-request` and rewritten URL's). A root slash `/` is added if a url matches the `default-root-object`.
1010

1111
## Example Path Transformations
1212

13-
| input | prefix | includeOriginPrefix | defaultRootObject | output |
14-
| ------------------------------------- | -------- | ------------------- | ----------------- | ----------------------------------------------------------- |
15-
| `index.html,blog.html,css/styles.css` | `(none)` | `false` | `index.html` | `/index.html,/blog.html,/css/styles.css,/` |
16-
| `root/index,/root/css/styles.css,/` | `root` | `false` | `index` | `/index,/css/styles.css,/` |
17-
| `root/index,root/css/styles.css` | `root` | `true` | `index` | `/index,/root/index,/css/styles.css,/root/css/styles.css,/` |
13+
| input | prefix | include-origin-prefix | default-root-object | output |
14+
| ------------------------------------- | -------- | --------------------- | ------------------- | ----------------------------------------------------------- |
15+
| `index.html,blog.html,css/styles.css` | `(none)` | `false` | `index.html` | `/index.html,/blog.html,/css/styles.css,/` |
16+
| `root/index,/root/css/styles.css,/` | `root` | `false` | `index` | `/index,/css/styles.css,/` |
17+
| `root/index,root/css/styles.css` | `root` | `true` | `index` | `/index,/root/index,/css/styles.css,/root/css/styles.css,/` |
1818

1919
## Getting Started
2020

@@ -50,24 +50,24 @@ jobs:
5050
name: Invalidate CloudFront Cache
5151
id: invalidate-cloudfront-cache
5252
with:
53-
distributionId: ${{ secrets.CFDistributionId }}
54-
awsRegion: 'us-east-1'
55-
originPrefix: 'root'
56-
includeOriginPrefix: true
57-
invalidatePaths: '/index.html,/'
58-
defaultRootObject: 'index.html'
53+
distribution-id: ${{ secrets.CFDistributionId }}
54+
aws-region: 'us-east-1'
55+
origin-prefix: 'root'
56+
include-origin-prefix: true
57+
invalidate-paths: '/index.html,/'
58+
default-root-object: 'index.html'
5959
```
6060
6161
## Action Inputs
6262
63-
| key | description | example |
64-
| --------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------- |
65-
| `invalidatePaths` | Comma separated list of invalidation paths | `root/blog.html,root/index.html` |
66-
| `distributionId` | The CloudFront Distribution Id | `ABC123DEF` |
67-
| `originPrefix` | The prefix of the object location in origin, which will be optionally stripped from the invalidation paths, if `includeOriginPrefix` is false. For example if originPrefix is "root" and invalidationPath is "root/blog.html" then the final path will be "blog.html" | `root` |
68-
| `includeOriginPrefix` | Whether to include origin prefix paths. Useful when paths ere rewritten by Lambda's | `true` |
69-
| `defaultRootObject` | The object returned when a user requests the root URL for your distribution. If this path is invalidated then a slash (/) is added to the invalidation paths | `index.html` |
70-
| `awsRegion` | The AWS region | `us-east-1` |
63+
| key | description | example |
64+
| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------- |
65+
| `invalidate-paths` | Comma separated list of invalidation paths | `root/blog.html,root/index.html` |
66+
| `distribution-id` | The CloudFront Distribution Id | `ABC123DEF` |
67+
| `origin-prefix` | The prefix of the object location in origin, which will be optionally stripped from the invalidation paths, if `include-origin-prefix` is false. For example if origin-prefix is "root" and invalidationPath is "root/blog.html" then the final path will be "blog.html" | `root` |
68+
| `include-origin-prefix` | Whether to include origin prefix paths. Useful when paths ere rewritten by Lambda's | `true` |
69+
| `default-root-object` | The object returned when a user requests the root URL for your distribution. If this path is invalidated then a slash (/) is added to the invalidation paths | `index.html` |
70+
| `aws-region` | The AWS region | `us-east-1` |
7171

7272
## Cache Invalidation Gotchas
7373

action.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,24 @@ branding:
55
icon: 'upload-cloud'
66
color: 'gray-dark'
77
inputs:
8-
invalidatePaths:
8+
invalidate-paths:
99
required: false
1010
default: ''
1111
description: 'Comma separated list of invalidation paths. For example: root/blog.html,root/index.html'
12-
distributionId:
12+
distribution-id:
1313
required: true
1414
description: 'The CloudFront Distribution Id'
15-
originPrefix:
15+
origin-prefix:
1616
required: false
1717
default: ''
18-
description: 'The prefix of the object location in origin, which will be stripped from the invalidation paths. For example if originPrefix is "root" and invalidationPath is "root/blog.html" then the final path will be "blog.html"'
19-
defaultRootObject:
18+
description: 'The prefix of the object location in origin, which will be stripped from the invalidation paths. For example if origin-prefix is "root" and invalidationPath is "root/blog.html" then the final path will be "blog.html"'
19+
default-root-object:
2020
required: true
2121
description: 'The object returned when a user requests the root URL for your distribution. If this path is invalidated then a slash (/) is added to the invalidation paths'
22-
awsRegion:
22+
aws-region:
2323
require: true
2424
description: 'The AWS region. For example: us-east-1'
25-
includeOriginPrefix:
25+
include-origin-prefix:
2626
require: true
2727
description: "Whether to include origin prefix paths. Useful when paths ere rewritten by Lambda's"
2828
runs:

dist/index.js

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/inputs.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,34 @@ import { getInput } from '@actions/core';
22

33
export function getInputs() {
44
const invalidatePaths =
5-
getInput('invalidatePaths', {
5+
getInput('invalidate-paths', {
66
required: false,
77
trimWhitespace: true,
88
}) || '';
99

10-
const distributionId = getInput('distributionId', {
10+
const distributionId = getInput('distribution-id', {
1111
required: true,
1212
trimWhitespace: true,
1313
});
1414

1515
const originPrefix =
16-
getInput('originPrefix', {
16+
getInput('origin-prefix', {
1717
required: false,
1818
trimWhitespace: true,
1919
}) || '';
2020

21-
const defaultRootObject = getInput('defaultRootObject', {
21+
const defaultRootObject = getInput('default-root-object', {
2222
required: true,
2323
trimWhitespace: true,
2424
});
2525

26-
const region = getInput('awsRegion', {
26+
const region = getInput('aws-region', {
2727
required: true,
2828
trimWhitespace: true,
2929
});
3030

3131
const includeOriginPrefix =
32-
getInput('includeOriginPrefix', {
32+
getInput('include-origin-prefix', {
3333
required: true,
3434
trimWhitespace: true,
3535
}).toLowerCase() === 'true';

0 commit comments

Comments
 (0)