diff --git a/.github/workflows/summary.yml b/.github/workflows/summary.yml index 6b42fb5..eedf627 100644 --- a/.github/workflows/summary.yml +++ b/.github/workflows/summary.yml @@ -1,25 +1,55 @@ - -name: "manual-input-workflow" +name: manual-revert-workflow on: workflow_dispatch: - input: - name: - - description: "Branches to revert" - - default: "World" - + inputs: + branch_name: + description: "Branch name to find and revert its merge commit in dev" required: true - jobs: - - check_inputs: - runs-on: "ubantu-latest" - + revert-merge: + runs-on: ubuntu-latest + steps: - - - name: Printing greeting - - run: echo "Hello how are you doing" \ No newline at end of file + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 # Fetch all history for proper commit lookup + + - name: Validate branch exists + run: | + if ! git show-ref --quiet refs/heads/${{ github.event.inputs.branch_name }}; then + echo "Error: Branch '${{ github.event.inputs.branch_name }}' does not exist" + exit 1 + fi + + - name: Switch to dev branch + run: git checkout dev + + - name: Find merge commit + id: find_merge + run: | + MERGE_COMMIT=$(git log --merges --first-parent dev --grep="Merge branch '${{ github.event.inputs.branch_name }}' into dev" --pretty=%H -n 1) + if [ -z "$MERGE_COMMIT" ]; then + echo "Error: No merge commit found from branch '${{ github.event.inputs.branch_name }}' into dev" + exit 1 + fi + echo "merge_commit=$MERGE_COMMIT" >> $GITHUB_OUTPUT + + - name: Revert merge commit + run: | + git revert -m 1 ${{ steps.find_merge.outputs.merge_commit }} --no-edit + if [ $? -ne 0 ]; then + echo "Error: Failed to revert merge commit ${{ steps.find_merge.outputs.merge_commit }}" + exit 1 + fi + + - name: Push revert to dev + run: | + git push origin dev + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Notify success + run: echo "Successfully reverted merge commit ${{ steps.find_merge.outputs.merge_commit }} from branch '${{ github.event.inputs.branch_name }}' in dev" \ No newline at end of file diff --git a/1.txt b/1.txt new file mode 100644 index 0000000..da2d398 --- /dev/null +++ b/1.txt @@ -0,0 +1 @@ +14 \ No newline at end of file diff --git a/2.txt b/2.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/2.txt @@ -0,0 +1 @@ + diff --git a/30.txt b/30.txt new file mode 100644 index 0000000..d69dd4e --- /dev/null +++ b/30.txt @@ -0,0 +1 @@ +line added from ft 32 \ No newline at end of file diff --git a/32.txt b/32.txt new file mode 100644 index 0000000..31422dc --- /dev/null +++ b/32.txt @@ -0,0 +1 @@ +first line on first commit from 32 \ No newline at end of file diff --git a/f11.txt b/f11.txt new file mode 100644 index 0000000..e69de29 diff --git a/f13.txt b/f13.txt new file mode 100644 index 0000000..5f0ec04 --- /dev/null +++ b/f13.txt @@ -0,0 +1,6 @@ + +# test commit 19 +# test commit 15 +# aded +de +here from f234 \ No newline at end of file diff --git a/main.py b/main.py index 1c83b82..0eed882 100644 --- a/main.py +++ b/main.py @@ -29,4 +29,11 @@ def merge_sorted_arrays(arr1, arr2): merged = merge_sorted_arrays(arr1, arr2) print(merged) # Output: [1, 2, 3, 4, 5, 6, 7, 8] -# this line added into the dev branch \ No newline at end of file +# This is an f5 feature edit +# this feature has been added from f6 + +# second commit f5 +# second commit f99 +# feature 7 added + +# added \ No newline at end of file