mirror of
https://github.com/forcedotcom/afv-library.git
synced 2026-07-30 03:09:50 +08:00
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:
parent
e8bcdd2fba
commit
5d3f085ad6
23
.github/workflows/release-skills.yml
vendored
23
.github/workflows/release-skills.yml
vendored
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user