-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
46 lines (45 loc) · 1.79 KB
/
action.yml
File metadata and controls
46 lines (45 loc) · 1.79 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
name: 'Gitar Duet Action'
description: 'Automates the Gitar Duet process for pull requests'
inputs:
github-token:
description: 'GitHub token for authentication. Make sure it has `content:write` scope.'
default: ${{ github.token }}
verbose:
description: 'Verbose output'
default: false
runs:
using: "composite"
steps:
- name: Get Pull Request Number
id: duet
run: |
if [[ ${{ inputs.verbose }} == true ]]; then
git --no-pager log -1 HEAD
fi
echo "::set-output name=pull_request_number::$(gh pr view --json number -q .number || echo "")"
shell: bash
env:
GITHUB_TOKEN: ${{ inputs.github-token }}
- run: |
if [[ ${{ inputs.verbose }} == true ]]; then
set -x
fi
if [[ -n $(git status --porcelain) ]]; then
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git commit -am "Gitar Duet for #${{ steps.duet.outputs.pull_request_number }}"
git checkout -b "gitar_duet_${{ steps.duet.outputs.pull_request_number }}"
git push origin "gitar_duet_${{ steps.duet.outputs.pull_request_number }}"
else
echo "No changes to commit"
fi
shell: bash
if: github.event.head_commit.author.name == 'Gitar' && steps.duet.outputs.pull_request_number != ''
- run: |
echo "Skipping Gitar Duet Action"
if [[ ${{ inputs.verbose }} == true ]]; then
echo "👼 Author: ${{ github.event.head_commit.author.name }}"
echo "☝️ Pull Request: ${{ steps.duet.outputs.pull_request_number }}"
fi
shell: bash
if: github.event.head_commit.author.name != 'Gitar' || steps.duet.outputs.pull_request_number == ''