-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
39 lines (36 loc) · 1.15 KB
/
action.yml
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
name: Reset head
description: Resetting hard branch to certain HEAD
branding:
icon: git-pull-request
color: red
inputs:
branch-name:
required: true
description: "The name of the branch to reset."
token:
description: "GitHub personal access token with repo write permission."
head:
description: "The commit or tag to reset the branch to."
default: "$GITHUB_REF_NAME"
runs:
using: "composite"
steps:
- uses: actions/checkout@v3
- name: Set git configuration
run: |
git config --global user.name github-actions[bot]
git config --global user.email 41898282+github-actions[bot]@users.noreply.github.com
shell: bash
- name: Set git remote URL
run: |
git remote set-url origin https://x-access-token:${{ inputs.github-secret }}@github.com/${{ github.repository }}
shell: bash
- name: Create new branch and reset to specified commit
run: |
git checkout -b "${{ inputs.branch-name }}"
git reset --hard ${{ inputs.head }}
shell: bash
- name: Force-push changes
run: |
git push --force origin "${{ inputs.branch-name }}"
shell: bash