mirror of
https://github.com/forcedotcom/afv-library.git
synced 2026-08-08 08:13:49 +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"
|
output-file: "CHANGELOG.md"
|
||||||
git-push: "false"
|
git-push: "false"
|
||||||
|
|
||||||
- name: Report validate-skills status on release commit
|
- name: Push release commit to main
|
||||||
if: ${{ steps.changelog.outputs.skipped == 'false' }}
|
if: ${{ steps.changelog.outputs.skipped == 'false' }}
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ secrets.IDEE_GH_TOKEN }}
|
GH_TOKEN: ${{ secrets.IDEE_GH_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
SHA=$(git rev-parse HEAD)
|
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" \
|
gh api "repos/${{ github.repository }}/statuses/$SHA" \
|
||||||
-f state=success \
|
-f state=success \
|
||||||
-f context=validate-skills \
|
-f context=validate-skills \
|
||||||
-f description="Validated in release workflow"
|
-f description="Validated in release workflow"
|
||||||
|
# Push to main (status check is now satisfied)
|
||||||
- name: Verify tag does not already exist
|
git push origin main --follow-tags
|
||||||
if: ${{ steps.changelog.outputs.skipped == 'false' }}
|
# Clean up temp branch
|
||||||
run: |
|
git push origin --delete "$TEMP_BRANCH" || true
|
||||||
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
|
|
||||||
|
|
||||||
- name: Create Github Release
|
- name: Create Github Release
|
||||||
id: release
|
id: release
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user