|
6 | 6 |
|
7 | 7 | A GitHub Action to invalidate a list of CloudFront paths.
|
8 | 8 |
|
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`. |
10 | 10 |
|
11 | 11 | ## Example Path Transformations
|
12 | 12 |
|
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,/` | |
18 | 18 |
|
19 | 19 | ## Getting Started
|
20 | 20 |
|
@@ -50,24 +50,24 @@ jobs:
|
50 | 50 | name: Invalidate CloudFront Cache
|
51 | 51 | id: invalidate-cloudfront-cache
|
52 | 52 | 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' |
59 | 59 | ```
|
60 | 60 |
|
61 | 61 | ## Action Inputs
|
62 | 62 |
|
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` | |
71 | 71 |
|
72 | 72 | ## Cache Invalidation Gotchas
|
73 | 73 |
|
|
0 commit comments