-
Notifications
You must be signed in to change notification settings - Fork 4
/
action.yml
43 lines (36 loc) · 1.44 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
41
42
43
name: Push to 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.
default: ${{ github.head_ref }}
force:
description: Should the push be forced?
default: false
deployToken:
description: GitHub Token that has write access to staging repository.
required: true
runs:
using: composite
steps:
- name: Pushing ${{ inputs.branch }} to ${{ 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
# Figure out if we should do a force push
export GIT_ARGS=''
if [[ x${{ inputs.force }} = 'xtrue' ]]; then
export GIT_ARGS=--force
fi
# Add local repository and push to it.
git remote add origin https://token:${{ inputs.deployToken }}@github.com/${{ inputs.owner }}/${{ inputs.repo }}.git
git fetch origin
git push $GIT_ARGS origin --verbose --no-recurse-submodules ${{ inputs.branch }}