Skip to content

Commit 1a8da73

Browse files
authored
ci: Sync github actions (#1)
* Delete not allowed file: .github/workflows/codeql-analysis.yml * Delete not allowed file: .github/workflows/gofmt.yml * Add new file: .github/workflows/build-test.yml * Add new file: .github/workflows/auto-merge.yml
1 parent fe72d14 commit 1a8da73

File tree

3 files changed

+65
-70
lines changed

3 files changed

+65
-70
lines changed

.github/workflows/auto-merge.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Dependabot Auto Build
2+
on: pull_request_target
3+
4+
permissions:
5+
pull-requests: write
6+
contents: write
7+
8+
jobs:
9+
metadata:
10+
runs-on: ubuntu-latest
11+
outputs:
12+
dependency-names: ${{ steps.metadata.outputs.dependency-names }}
13+
steps:
14+
- name: Dependabot metadata
15+
uses: Xuanwo/fetch-metadata@v1.2.2
16+
id: metadata
17+
with:
18+
github-token: "${{ secrets.GITHUB_TOKEN }}"
19+
20+
dependabot:
21+
needs: metadata
22+
if: ${{ needs.metadata.outputs.dependency-names != '' }}
23+
runs-on: ubuntu-latest
24+
steps:
25+
- name: Set up Go 1.x
26+
uses: actions/setup-go@v2
27+
with:
28+
go-version: "1.16"
29+
30+
- name: Checkout repository
31+
uses: actions/checkout@v2
32+
with:
33+
ref: ${{ github.head_ref }}
34+
token: ${{ secrets.ROBOT_GITHUB_TOKEN }}
35+
36+
- name: Auto build
37+
run: make build
38+
39+
- name: Auto commit
40+
uses: stefanzweifel/git-auto-commit-action@v4
41+
if: ${{contains(needs.metadata.outputs.dependency-names, 'github.com/beyondstorage/go-storage/v4')}}
42+
with:
43+
commit_message: Auto build to generate code
44+
45+
- name: Auto merge
46+
run: gh pr merge --auto --squash "$PR_URL"
47+
env:
48+
PR_URL: ${{ github.event.pull_request.html_url }}
49+
GITHUB_TOKEN: ${{ secrets.ROBOT_GITHUB_TOKEN }}
50+
51+
- name: Auto approve
52+
run: gh pr review "$PR_URL" -a
53+
env:
54+
PR_URL: ${{ github.event.pull_request.html_url }}
55+
GITHUB_TOKEN: ${{ secrets.ROBOT_GITHUB_TOKEN }}
Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,26 @@
1-
name: "gofmt"
1+
name: "Build Test"
22

33
on: [ push,pull_request ]
44

55
jobs:
6-
gofmt:
7-
name: gofmt
6+
build_test:
7+
name: Build Test
88
runs-on: ubuntu-latest
99

1010
steps:
1111
- name: Set up Go 1.x
1212
uses: actions/setup-go@v2
1313
with:
14-
go-version: "1.15"
14+
go-version: "1.16"
1515

1616
- name: Checkout repository
1717
uses: actions/checkout@v2
1818

1919
- name: Format
2020
run: if [ "$(gofmt -l . | wc -l)" -gt 0 ]; then exit 1; fi
21+
22+
- name: Build
23+
run: make build
24+
25+
- name: Git Diff
26+
run: if [ "$(git diff | wc -l)" -gt 0 ]; then exit 1; fi

.github/workflows/codeql-analysis.yml

Lines changed: 0 additions & 66 deletions
This file was deleted.

0 commit comments

Comments
 (0)