forked from The-OpenROAD-Project/actions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
40 lines (33 loc) · 1.36 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
40
name: Delete branch from a repository.
inputs:
owner:
description: GitHub username who owns the repository.
default: ${{ github.event.repository.owner.name }}
repo:
description: GitHub repo name.
default: ${{ github.event.repository.name }}
branch:
description: Branch to push.
required: true
deployToken:
description: GitHub Token that has write access to staging repository.
required: true
runs:
using: composite
steps:
- name: Deleting ${{ inputs.branch }} from ${{ inputs.slug }}
shell: bash
run: |
if [[ -z "${{ inputs.owner }}" ]]; then echo "Missing owner value!"; exit 1; fi
if [[ -z "${{ inputs.repo }}" ]]; then echo "Missing repo value!"; exit 1; fi
if [[ -z "${{ inputs.branch }}" ]]; then echo "Missing branch value!"; exit 1; fi
if [[ -z "${{ inputs.deployToken }}" ]]; then echo "Missing deployToken value!"; exit 1; fi
# Set the defaultBranch to supress noisy hint.
git config --global init.defaultBranch main
# Add local repository and push to it.
rm -rf ${{ inputs.repo }}
mkdir -p ${{ inputs.repo }}
cd ${{ inputs.repo }}
git init --quiet
git remote add origin https://token:${{ inputs.deployToken }}@github.com/${{ inputs.owner }}/${{ inputs.repo }}.git
git push origin --verbose :${{ inputs.branch }}