Skip to content

aws-arch-pricing

aws-arch-pricing #105

name: aws-arch-pricing
on:
workflow_dispatch: {}
schedule:
- cron: 0 0 * * 1
jobs:
update:
name: Update Pricing
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
patch_created: ${{ steps.create_patch.outputs.patch_created }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: mainline
- name: PDK Init
uses: ./.github/actions/pdk-init
- name: Fetch Pricing Manifest
working-directory: packages/aws-arch
run: pnpm projen fetch-pricing-manifest
- name: Build
working-directory: packages/aws-arch
# Need to run each build step manually to allow updating snapshots in test
run: |-
pnpm projen pre-compile
pnpm projen compile
pnpm projen post-compile
pnpm jest --updateSnapshot
pnpm projen package
- 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 "has_mutations=true" >> $GITHUB_OUTPUT
- if: steps.mutation_check.outputs.has_mutations
id: create_patch
name: Create Patch
run: |-
git diff --staged --patch --exit-code > .repo.patch || echo "patch_created=true" >> $GITHUB_OUTPUT
- if: steps.create_patch.outputs.patch_created
name: Upload patch
uses: actions/upload-artifact@v2
with:
name: .repo.patch
path: .repo.patch
pr:
name: Create Pull Request
needs: update
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
if: ${{ needs.update.outputs.patch_created }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
token: ${{ secrets.PROJEN_GITHUB_TOKEN }}
ref: mainline
- name: Download patch
uses: actions/download-artifact@v2
with:
name: .repo.patch
path: ${{ runner.temp }}
- name: Apply patch
run: '[ -s ${{ runner.temp }}/.repo.patch ] && git apply ${{ runner.temp }}/.repo.patch || echo "Empty patch. Skipping."'
- name: Set git identity
run: |-
git config user.name "github-actions"
git config user.email "[email protected]"
- name: Create Pull Request
id: create-pr
uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.PROJEN_GITHUB_TOKEN }}
commit-message: |-
chore(aws-arch): update pricing manifest
Update aws pricing manifest and snapshots for aws-arch package. See details in [workflow run].
[Workflow Run]: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
branch: github-actions/aws-arch-pricing
title: "chore(aws-arch): update pricing manifest"
body: |-
Update aws pricing manifest and snapshots for aws-arch package. See details in [workflow run].
[Workflow Run]: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
author: github-actions <[email protected]>
committer: github-actions <[email protected]>
signoff: false