From e21f3eebe3d0d8bae5e178349f6ee2d580efc204 Mon Sep 17 00:00:00 2001 From: Roland Krummenacher Date: Mon, 31 Aug 2026 10:14:11 +0200 Subject: [PATCH 1/2] fix(ci): replace ISF gh pr create with a job-summary PR link The org disallows GitHub Actions from opening pull requests, so `gh pr create` fails with "GitHub Actions is not permitted to create or approve pull requests (createPullRequest)". The weekly run has failed on 17, 24 and 31 August -- every run since the first one that actually had a data change to publish. The 3 and 10 August runs passed only because they detected no changes and exited before the PR step, so the break was introduced with the step itself and stayed latent for two weeks. The fetch and the branch push both work; only the PR call fails. Each failed run therefore left an orphan branch behind, all three carrying the same one-row update. Mirrors the pattern already used by opendata-commitment-eligibility.yml, which hit the same wall: push the branch, then write a one-click compare link into the job summary for a maintainer to open. Opening the PR from there still triggers Open Data CI and normal review. Also drops the now-unused `pull-requests: write` permission and the GITHUB_TOKEN env var, and appends run_number to the branch name so a same-day re-run cannot collide with the branch an earlier run pushed. Co-Authored-By: Claude Opus 5 (1M context) --- .../opendata-instance-size-flexibility.yml | 69 ++++++++++++------- 1 file changed, 44 insertions(+), 25 deletions(-) diff --git a/.github/workflows/opendata-instance-size-flexibility.yml b/.github/workflows/opendata-instance-size-flexibility.yml index 6eb179276..ab3ea743a 100644 --- a/.github/workflows/opendata-instance-size-flexibility.yml +++ b/.github/workflows/opendata-instance-size-flexibility.yml @@ -15,7 +15,6 @@ on: # so the subscription only serves as an API routing scope. permissions: contents: write - pull-requests: write id-token: write jobs: @@ -45,25 +44,11 @@ jobs: shell: pwsh run: src/scripts/Update-InstanceSizeFlexibility.ps1 - - name: Create PR if data changed - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - PR_BODY: | - ## Summary - - Weekly automated update of instance size flexibility (ISF) ratios from the - [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). - - This file maps each ARM SKU to its instance size flexibility group and ratio, - replacing the deprecated `AutofitComboMeterData.csv` and `isfratioblob.csv` files - that were hosted on `ccmstorageprod.blob.core.windows.net` (retired 30 Aug 2026). - - ## Test plan - - - [ ] Review the diff for unexpected changes (large drops in group/SKU count, etc.) - - [ ] Spot-check a few SKUs against the Azure Pricing Calculator - - 🤖 Generated by the **Update Instance Size Flexibility** workflow + # 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 && \ @@ -72,7 +57,9 @@ jobs: exit 0 fi - BRANCH="opendata/instance-size-flexibility-$(date +%Y%m%d)" + # run_number keeps a re-run on the same day from colliding with the branch + # the earlier run already pushed. + BRANCH="opendata/instance-size-flexibility-$(date +%Y%m%d)-${{ github.run_number }}" git checkout -b "$BRANCH" git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" @@ -80,7 +67,39 @@ jobs: git commit -m "chore: Update instance size flexibility ratios" git push origin "$BRANCH" - gh pr create \ - --title "[Open Data] Update instance size flexibility ratios ($(date +'%B %Y'))" \ - --base dev \ - --body "$PR_BODY" + 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" From 8fc8686083e0782583b6c572548a46a9b22b672b Mon Sep 17 00:00:00 2001 From: Roland Krummenacher Date: Tue, 1 Sep 2026 08:57:47 +0200 Subject: [PATCH 2/2] fix(ci): include run_attempt in ISF data-update branch name run_number stays the same when a workflow run is re-run, so a re-run of a run that already pushed its branch would hit a rejected push. Append run_attempt, which increments per attempt. Co-Authored-By: Claude Opus 5 (1M context) --- .github/workflows/opendata-instance-size-flexibility.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/opendata-instance-size-flexibility.yml b/.github/workflows/opendata-instance-size-flexibility.yml index ab3ea743a..370731907 100644 --- a/.github/workflows/opendata-instance-size-flexibility.yml +++ b/.github/workflows/opendata-instance-size-flexibility.yml @@ -57,9 +57,10 @@ jobs: exit 0 fi - # run_number keeps a re-run on the same day from colliding with the branch - # the earlier run already pushed. - BRANCH="opendata/instance-size-flexibility-$(date +%Y%m%d)-${{ github.run_number }}" + # 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"