fix: resolve release workflow branch protection failure @W-21658353@ (#80)

fix: resolve release workflow branch protection failure

Push release commit to a temp branch first so the SHA is visible to
the GitHub API, then report the required validate-skills status check
before pushing to main.

Co-authored-by: Hemant Singh Bisht <hsinghbisht@salesforce.com>
This commit is contained in:
Mohan Raj Rajamanickam 2026-03-23 09:32:18 -07:00 committed by GitHub
parent e8bcdd2fba
commit 5d3f085ad6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -58,29 +58,24 @@ jobs:
output-file: "CHANGELOG.md"
git-push: "false"
- name: Report validate-skills status on release commit
- name: Push release commit to main
if: ${{ steps.changelog.outputs.skipped == 'false' }}
env:
GH_TOKEN: ${{ secrets.IDEE_GH_TOKEN }}
run: |
SHA=$(git rev-parse HEAD)
TEMP_BRANCH="release-$(date +%s)"
# Push commit to a temp branch so the SHA exists on the remote
git push origin "$SHA:refs/heads/$TEMP_BRANCH"
# Report the required status check on the now-visible commit
gh api "repos/${{ github.repository }}/statuses/$SHA" \
-f state=success \
-f context=validate-skills \
-f description="Validated in release workflow"
- name: Verify tag does not already exist
if: ${{ steps.changelog.outputs.skipped == 'false' }}
run: |
TAG="${{ steps.changelog.outputs.tag }}"
if git ls-remote --tags origin | grep -q "refs/tags/$TAG$"; then
echo "::error::Tag $TAG already exists on remote. Delete it first if re-releasing: git push --delete origin $TAG"
exit 1
fi
- name: Push release commit and tag
if: ${{ steps.changelog.outputs.skipped == 'false' }}
run: git push origin main --follow-tags
# Push to main (status check is now satisfied)
git push origin main --follow-tags
# Clean up temp branch
git push origin --delete "$TEMP_BRANCH" || true
- name: Create Github Release
id: release