Update Instance Size Flexibility #9
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Update Instance Size Flexibility | |
| on: | |
| schedule: | |
| - cron: '0 6 * * 1' # Every Monday at 06:00 UTC | |
| workflow_dispatch: | |
| # Unlike the other open data workflows, the Catalogs API is authenticated and requires | |
| # Microsoft.Capacity/catalogs/read. Auth uses the dedicated "finops-toolkit-opendata-reader" | |
| # app registration in the FinOps Toolkit tenant: an OIDC federated credential trusts workflow | |
| # runs on this repo's dev branch (subject repo:microsoft/finops-toolkit:ref:refs/heads/dev), | |
| # and the principal holds only the Reader role on the subscription below, which has the | |
| # Microsoft.Capacity resource provider registered. No client secret is stored anywhere, and | |
| # the IDs below are identifiers, not secrets. The catalog content is subscription-independent, | |
| # so the subscription only serves as an API routing scope. | |
| permissions: | |
| contents: write | |
| id-token: write | |
| jobs: | |
| update: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| ref: dev | |
| - name: Install Az.Accounts | |
| shell: pwsh | |
| run: | | |
| Set-PSRepository PSGallery -InstallationPolicy Trusted | |
| Install-Module -Name Az.Accounts -RequiredVersion 2.19.0 -Force | |
| - name: Login via Az module | |
| uses: azure/login@264ef4588d3ca547fea5296679ee9f8a4766d4df # hf_447_release | |
| with: | |
| client-id: 07fb13e5-41ca-4f29-8d5e-cc4244db260b # finops-toolkit-opendata-reader | |
| tenant-id: 38a09d9b-84be-4c40-8aef-99ebeed474ff # FinOps Toolkit tenant | |
| subscription-id: 6c3cfdf5-688d-4259-9ef6-c3bbfb355c57 | |
| enable-AzPSSession: true | |
| - name: Fetch ISF ratios from Azure Catalogs API | |
| shell: pwsh | |
| run: src/scripts/Update-InstanceSizeFlexibility.ps1 | |
| # GitHub Actions is not permitted to open pull requests in this org, so we push | |
| # a branch and surface a one-click "create PR" link in the job summary for a | |
| # maintainer to open. Opening the PR triggers Open Data CI and normal review. | |
| # This mirrors opendata-commitment-eligibility.yml, which hit the same wall. | |
| - name: Push branch and surface PR link if data changed | |
| run: | | |
| # Check for changes (handles both new file and modified file) | |
| if git diff --quiet --exit-code -- src/open-data/InstanceSizeFlexibility.csv 2>/dev/null && \ | |
| ! git ls-files --others --exclude-standard | grep -q 'InstanceSizeFlexibility.csv'; then | |
| echo "No changes detected" | |
| exit 0 | |
| fi | |
| # run_number keeps a re-run on the same day from colliding with the branch an | |
| # earlier run already pushed; run_attempt does the same for a re-run of this | |
| # run, which keeps run_number and only increments the attempt. | |
| BRANCH="opendata/instance-size-flexibility-$(date +%Y%m%d)-${{ github.run_number }}.${{ github.run_attempt }}" | |
| git checkout -b "$BRANCH" | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add src/open-data/InstanceSizeFlexibility.csv | |
| git commit -m "chore: Update instance size flexibility ratios" | |
| git push origin "$BRANCH" | |
| PR_URL="${{ github.server_url }}/${{ github.repository }}/compare/dev...${BRANCH}?expand=1" | |
| { | |
| echo "### Instance size flexibility ratios updated" | |
| echo "" | |
| echo "Pushed branch \`${BRANCH}\`. GitHub Actions cannot open PRs in this repo, so open it manually:" | |
| echo "" | |
| echo "[**Create pull request →**](${PR_URL})" | |
| echo "" | |
| echo "Suggested title:" | |
| echo "" | |
| echo '```' | |
| echo "[Open Data] Update instance size flexibility ratios ($(date +'%B %Y'))" | |
| echo '```' | |
| echo "" | |
| echo "Suggested body:" | |
| echo "" | |
| echo '```markdown' | |
| echo "## Summary" | |
| echo "" | |
| echo "Weekly automated update of instance size flexibility (ISF) ratios from the" | |
| echo "[Azure Reservations Catalogs API](https://learn.microsoft.com/azure/cost-management-billing/reservations/instance-size-flexibility#extract-instance-size-flexibility-ratios-using-azure-catalogs-api)." | |
| echo "" | |
| echo "This file maps each ARM SKU to its instance size flexibility group and ratio," | |
| echo "replacing the deprecated \`AutofitComboMeterData.csv\` and \`isfratioblob.csv\` files" | |
| echo "that were hosted on \`ccmstorageprod.blob.core.windows.net\` (retired 30 Aug 2026)." | |
| echo "" | |
| echo "## Test plan" | |
| echo "" | |
| echo "- [ ] Review the diff for unexpected changes (large drops in group/SKU count, etc.)" | |
| echo "- [ ] Spot-check a few SKUs against the Azure Pricing Calculator" | |
| echo "" | |
| echo "🤖 Generated by the **Update Instance Size Flexibility** workflow" | |
| echo '```' | |
| } >> "$GITHUB_STEP_SUMMARY" | |
| echo "Branch pushed: $BRANCH" | |
| echo "Open a PR here: $PR_URL" |