forked from mlcommons/mlcflow
-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (39 loc) · 1.25 KB
/
reset-fork.yml
File metadata and controls
47 lines (39 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
name: Reset Current Branch to Upstream After Squash Merge
on:
workflow_dispatch:
inputs:
branch:
description: 'Branch to reset (leave blank for current branch)'
required: false
default: ''
permissions:
contents: write
jobs:
reset-branch:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
fetch-depth: 0
- name: Detect Current Branch
if: ${{ inputs.branch == '' }}
run: echo "branch=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_ENV
- name: Use Input Branch
if: ${{ inputs.branch != '' }}
env:
BRANCH_INPUT: ${{ inputs.branch }}
run: echo "branch=${BRANCH_INPUT}" >> $GITHUB_ENV
- name: Add Upstream Remote
run: |
git remote add upstream https://github.com/mlcommons/mlcflow.git
git fetch upstream
- name: Reset Branch to Upstream
run: |
git checkout ${{ env.branch }}
git reset --hard upstream/${{ env.branch }}
if: success()
- name: Force Push to Origin
run: |
git push origin ${{ env.branch }} --force-with-lease
if: success()