From 9965e35a85f8f42a80fd622a0a29b54a29a896ef Mon Sep 17 00:00:00 2001 From: JJGadgets Date: Mon, 20 May 2024 07:14:07 +0800 Subject: [PATCH] fix(actions/flux-localhost-build): update or create --- .github/workflows/flux-localhost-build.yaml | 26 ++++++++++++--------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/.github/workflows/flux-localhost-build.yaml b/.github/workflows/flux-localhost-build.yaml index 2cf4839f5c..b77bc006e8 100644 --- a/.github/workflows/flux-localhost-build.yaml +++ b/.github/workflows/flux-localhost-build.yaml @@ -82,16 +82,20 @@ jobs: export MESSAGE="${{ env.MESSAGE }}" export SHA=$( git rev-parse ${{ env.DESTINATION_BRANCH }}:${{ env.FILE_TO_COMMIT }} ) export CONTENT=$( base64 -i ${{ env.FILE_TO_COMMIT }} ) - gh api --method PUT /repos/:owner/:repo/contents/${{ env.FILE_TO_COMMIT }} \ - --field message="${MESSAGE}" \ - --field content="${CONTENT}" \ - --field encoding="base64" \ - --field branch="${{ env.DESTINATION_BRANCH }}" \ - --field sha="${SHA}" \ - || gh api --method PUT /repos/:owner/:repo/contents/${{ env.FILE_TO_COMMIT }} \ - --field message="${MESSAGE}" \ - --field content="${CONTENT}" \ - --field encoding="base64" \ - --field branch="${{ env.DESTINATION_BRANCH }}" \ + if gh api --method PUT /repos/:owner/:repo/contents/${{ env.FILE_TO_COMMIT }} \ + --field message="${MESSAGE}" \ + --field content="${CONTENT}" \ + --field encoding="base64" \ + --field branch="${{ env.DESTINATION_BRANCH }}" \ + --field sha="${SHA}" ; then + echo "Pushed signed commit to GitHub." + else if gh api --method PUT /repos/:owner/:repo/contents/${{ env.FILE_TO_COMMIT }} \ + --field message="${MESSAGE}" \ + --field content="${CONTENT}" \ + --field encoding="base64" \ + --field branch="${{ env.DESTINATION_BRANCH }}" \ + echo "Pushed signed commit to GitHub." + else || echo "No changes to push or errored pushing." + fi gh pr create --base main --head ${{ env.BRANCH }} --title "${{ env.MESSAGE }}" --body "Updates Flux install manifests, patched for use with localhost hostNetwork, to the ${{ env.FLUX_VERSION }} version." --reviewer ${{ github.repository_owner }}