Skip to content

Hard Reset Branch

Hard Reset Branch #68

name: Hard Reset Branch
on:
workflow_dispatch:
inputs:
branch_to_reset:
description: 'Branch to hard reset'
required: true
default: 'master'
jobs:
hard_reset_branch:
runs-on: ubuntu-latest
environment: release
steps:
- name: Checkout the repository
uses: actions/checkout@v3
with:
token: ${{ secrets.JENKINSGENESIS_TOKEN }}
ref: ${{ github.event.inputs.branch_to_reset }}
fetch-depth: 0 # Fetch all history for git reset
- name: Fetch all branches
run: git fetch --all
- name: Hard reset the branch to preprod
run: git reset --hard origin/preprod
- name: Push hard reset branch
run: git push origin ${{ github.event.inputs.branch_to_reset }} --force
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}