forked from wazuh/wazuh-docker
Added bump-issue-link support for Revert Stage Bump
This commit is contained in:
@@ -37,6 +37,11 @@ on:
|
|||||||
default: false
|
default: false
|
||||||
required: false
|
required: false
|
||||||
type: boolean
|
type: boolean
|
||||||
|
bump-issue-link:
|
||||||
|
description: 'Issue link used in the original bump (required for revert if different from issue-link)'
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
bump:
|
bump:
|
||||||
name: Repository bumper 5.x
|
name: Repository bumper 5.x
|
||||||
@@ -146,9 +151,18 @@ jobs:
|
|||||||
id: revert_step
|
id: revert_step
|
||||||
if: inputs.revert == true
|
if: inputs.revert == true
|
||||||
run: |
|
run: |
|
||||||
|
# 1. Get the current issue number (for the new revert branch/PR)
|
||||||
ISSUE_NUMBER=$(echo "${{ inputs.issue-link }}" | awk -F'/' '{print $NF}')
|
ISSUE_NUMBER=$(echo "${{ inputs.issue-link }}" | awk -F'/' '{print $NF}')
|
||||||
|
|
||||||
BUMP_BRANCH="enhancement/wqa${ISSUE_NUMBER}-bump-${{ github.ref_name }}"
|
# 2. Get the issue number from the original bump (if provided; otherwise, defaults to the current one)
|
||||||
|
if [ -n "${{ inputs.bump-issue-link }}" ]; then
|
||||||
|
BUMP_ISSUE_NUMBER=$(echo "${{ inputs.bump-issue-link }}" | awk -F'/' '{print $NF}')
|
||||||
|
else
|
||||||
|
BUMP_ISSUE_NUMBER=$ISSUE_NUMBER
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 3. Search for the original bump branch using the obtained BUMP ISSUE number
|
||||||
|
BUMP_BRANCH="enhancement/wqa${BUMP_ISSUE_NUMBER}-bump-${{ github.ref_name }}"
|
||||||
|
|
||||||
PR_NUMBER=$(gh pr list --head "$BUMP_BRANCH" --base "${{ github.ref_name }}" --state merged --json number --jq '.[0].number')
|
PR_NUMBER=$(gh pr list --head "$BUMP_BRANCH" --base "${{ github.ref_name }}" --state merged --json number --jq '.[0].number')
|
||||||
|
|
||||||
@@ -167,7 +181,7 @@ jobs:
|
|||||||
# Remove the files to prevent them from being included in the revert commit
|
# Remove the files to prevent them from being included in the revert commit
|
||||||
git checkout HEAD -- VERSION.json 2>/dev/null || true
|
git checkout HEAD -- VERSION.json 2>/dev/null || true
|
||||||
git checkout HEAD -- CHANGELOG.md 2>/dev/null || true
|
git checkout HEAD -- CHANGELOG.md 2>/dev/null || true
|
||||||
# Add any other repository-specific version files here
|
# [!] ADD ANY OTHER REPOSITORY-SPECIFIC VERSION FILES HERE [!]
|
||||||
|
|
||||||
if git diff --staged --quiet; then
|
if git diff --staged --quiet; then
|
||||||
echo "No references to revert. Skipping commit."
|
echo "No references to revert. Skipping commit."
|
||||||
|
|||||||
Reference in New Issue
Block a user