Skip to content

Commit

Permalink
chore(workflow): improve pricing workflow
Browse files Browse the repository at this point in the history
- indent pricing manifest to make reviewing changes possible
- only create pricing pr if non manifest change found
  • Loading branch information
JeremyJonas committed Oct 3, 2023
1 parent 1a542c1 commit 19514d6
Show file tree
Hide file tree
Showing 3 changed files with 14,737 additions and 8 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/aws-arch-pricing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,16 @@ jobs:
pnpm projen post-compile
pnpm jest --updateSnapshot
pnpm projen package
- id: create_patch
name: Find mutations
- id: mutation_check
name: Find Mutations
# ignore diff if only the pricing manifest json was modified
run: |-
git add .
git diff --staged --name-only --exit-code -- ':!packages/aws-arch/static/aws-pricing-manifest.json' || echo "::set-output name=has_mutations::true"
- if: steps.mutation_check.outputs.has_mutations
id: create_patch
name: Create Patch
run: |-
git diff --staged --patch --exit-code > .repo.patch || echo "::set-output name=patch_created::true"
- if: steps.create_patch.outputs.patch_created
name: Upload patch
Expand Down
9 changes: 4 additions & 5 deletions packages/aws-arch/scripts/aws-arch/fetch-pricing-manifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@
See the License for the specific language governing permissions and
limitations under the License.
******************************************************************************************************************** */
import * as path from 'path';
import * as util from 'util';
import * as stream from 'stream';
import * as fs from 'fs-extra';
import * as path from 'node:path';
import * as fs from 'node:fs/promises';
import fetch from 'node-fetch';

const URL = 'https://d1qsjq9pzbk1k6.cloudfront.net/manifest/en_US.json';
Expand All @@ -31,6 +29,7 @@ const FILEPATH = path.join(__dirname, '..', '..', 'static', 'aws-pricing-manifes
console.debug(response);
throw new Error(`Failed to download pricing manifest: ${response.statusText} - ${response.statusText}`);
}
await util.promisify(stream.pipeline)(response.body, fs.createWriteStream(FILEPATH));
const jsonData = await response.json();
await fs.writeFile(FILEPATH, JSON.stringify(jsonData, null, 2));
console.info('Done - pricing manifest fetched')
})();
14,726 changes: 14,725 additions & 1 deletion packages/aws-arch/static/aws-pricing-manifest.json

Large diffs are not rendered by default.

0 comments on commit 19514d6

Please sign in to comment.