forked from wazuh/wazuh-docker
Fix bumper workflow failure when bump produces no changes
This commit is contained in:
@@ -144,10 +144,17 @@ jobs:
|
|||||||
bash ${{ env.BUMP_SCRIPT_PATH }} ${{ steps.vars.outputs.script_params }}
|
bash ${{ env.BUMP_SCRIPT_PATH }} ${{ steps.vars.outputs.script_params }}
|
||||||
|
|
||||||
- name: Commit changes (Bump)
|
- name: Commit changes (Bump)
|
||||||
|
id: bump_commit
|
||||||
if: inputs.revert != true
|
if: inputs.revert != true
|
||||||
run: |
|
run: |
|
||||||
git add .
|
git add .
|
||||||
git commit -m "feat: bump ${{ github.ref_name }}"
|
if git diff --staged --quiet; then
|
||||||
|
echo "Nothing to bump: the repository is already at the requested version/stage. Skipping commit."
|
||||||
|
echo "has_changes=false" >> $GITHUB_OUTPUT
|
||||||
|
else
|
||||||
|
git commit -m "feat: bump ${{ github.ref_name }}"
|
||||||
|
echo "has_changes=true" >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Fetch full history (Revert)
|
- name: Fetch full history (Revert)
|
||||||
if: inputs.revert == true
|
if: inputs.revert == true
|
||||||
@@ -198,13 +205,13 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Push changes
|
- name: Push changes
|
||||||
if: inputs.revert != true || (inputs.revert == true && steps.revert_step.outputs.has_changes == 'true')
|
if: (inputs.revert != true && steps.bump_commit.outputs.has_changes == 'true') || (inputs.revert == true && steps.revert_step.outputs.has_changes == 'true')
|
||||||
run: |
|
run: |
|
||||||
git push origin ${{ steps.vars.outputs.branch_name }}
|
git push origin ${{ steps.vars.outputs.branch_name }}
|
||||||
|
|
||||||
- name: Create pull request
|
- name: Create pull request
|
||||||
id: create_pr
|
id: create_pr
|
||||||
if: inputs.revert != true || (inputs.revert == true && steps.revert_step.outputs.has_changes == 'true')
|
if: (inputs.revert != true && steps.bump_commit.outputs.has_changes == 'true') || (inputs.revert == true && steps.revert_step.outputs.has_changes == 'true')
|
||||||
run: |
|
run: |
|
||||||
gh auth setup-git
|
gh auth setup-git
|
||||||
PR_URL=$(gh pr create \
|
PR_URL=$(gh pr create \
|
||||||
@@ -217,7 +224,7 @@ jobs:
|
|||||||
echo "pull_request_url=${PR_URL}" >> $GITHUB_OUTPUT
|
echo "pull_request_url=${PR_URL}" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Merge pull request
|
- name: Merge pull request
|
||||||
if: inputs.revert != true || (inputs.revert == true && steps.revert_step.outputs.has_changes == 'true')
|
if: (inputs.revert != true && steps.bump_commit.outputs.has_changes == 'true') || (inputs.revert == true && steps.revert_step.outputs.has_changes == 'true')
|
||||||
run: |
|
run: |
|
||||||
# Any checks for the PR are bypassed since the branch is expected to be functional
|
# Any checks for the PR are bypassed since the branch is expected to be functional
|
||||||
gh pr merge "${{ steps.create_pr.outputs.pull_request_url }}" --merge --admin
|
gh pr merge "${{ steps.create_pr.outputs.pull_request_url }}" --merge --admin
|
||||||
@@ -225,9 +232,13 @@ jobs:
|
|||||||
- name: Show logs
|
- name: Show logs
|
||||||
if: inputs.revert != true
|
if: inputs.revert != true
|
||||||
run: |
|
run: |
|
||||||
echo "Bump complete."
|
if [[ "${{ steps.bump_commit.outputs.has_changes }}" == "true" ]]; then
|
||||||
echo "Branch: ${{ steps.vars.outputs.branch_name }}"
|
echo "Bump complete."
|
||||||
echo "PR: ${{ steps.create_pr.outputs.pull_request_url }}"
|
echo "Branch: ${{ steps.vars.outputs.branch_name }}"
|
||||||
|
echo "PR: ${{ steps.create_pr.outputs.pull_request_url }}"
|
||||||
|
else
|
||||||
|
echo "Bump skipped: the repository is already at the requested version/stage."
|
||||||
|
fi
|
||||||
echo "Bumper scripts logs:"
|
echo "Bumper scripts logs:"
|
||||||
cat ${BUMP_LOG_PATH}/repository_bumper*log
|
cat ${BUMP_LOG_PATH}/repository_bumper*log
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user