-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstep-1.sh
More file actions
executable file
·47 lines (38 loc) · 1000 Bytes
/
step-1.sh
File metadata and controls
executable file
·47 lines (38 loc) · 1000 Bytes
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
#!/bin/bash
SCRIPTDIR=$(cd $(dirname $0); pwd)
set -eu
cd $SCRIPTDIR/../github-actions
stepNum=1
stepName=development
branchName="step-$stepNum"
startCommit=$(git log --reverse -n $stepNum --pretty=format:%H)
if git rev-parse --verify $branchName &>/dev/null; then
git reset --hard HEAD
git checkout main
git branch -D $branchName;
fi
git checkout -b $branchName $startCommit
mkdir -p .github/workflows
cat <<EOT > .github/workflows/$stepName.yml
name: pr branch jobs
on: [pull_request]
jobs:
$stepName:
environment: $stepName
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Go Tooling Preparation
uses: actions/setup-go@v3
with:
go-version: '1.17'
cache: true
- run: go vet ./...
- run: go build ./...
- run: go test ./...
- run: go run .
EOT
git add .
git commit -m "$branchName $stepName workflow"
git push -uf origin $branchName