Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Sync github actions #1

Merged
merged 4 commits into from
Sep 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions .github/workflows/auto-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Dependabot Auto Build
on: pull_request_target

permissions:
pull-requests: write
contents: write

jobs:
metadata:
runs-on: ubuntu-latest
outputs:
dependency-names: ${{ steps.metadata.outputs.dependency-names }}
steps:
- name: Dependabot metadata
uses: Xuanwo/fetch-metadata@v1.2.2
id: metadata
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"

dependabot:
needs: metadata
if: ${{ needs.metadata.outputs.dependency-names != '' }}
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: "1.16"

- name: Checkout repository
uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
token: ${{ secrets.ROBOT_GITHUB_TOKEN }}

- name: Auto build
run: make build

- name: Auto commit
uses: stefanzweifel/git-auto-commit-action@v4
if: ${{contains(needs.metadata.outputs.dependency-names, 'github.com/beyondstorage/go-storage/v4')}}
with:
commit_message: Auto build to generate code

- name: Auto merge
run: gh pr merge --auto --squash "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.ROBOT_GITHUB_TOKEN }}

- name: Auto approve
run: gh pr review "$PR_URL" -a
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.ROBOT_GITHUB_TOKEN }}
14 changes: 10 additions & 4 deletions .github/workflows/gofmt.yml → .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@
name: "gofmt"
name: "Build Test"

on: [ push,pull_request ]

jobs:
gofmt:
name: gofmt
build_test:
name: Build Test
runs-on: ubuntu-latest

steps:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: "1.15"
go-version: "1.16"

- name: Checkout repository
uses: actions/checkout@v2

- name: Format
run: if [ "$(gofmt -l . | wc -l)" -gt 0 ]; then exit 1; fi

- name: Build
run: make build

- name: Git Diff
run: if [ "$(git diff | wc -l)" -gt 0 ]; then exit 1; fi
66 changes: 0 additions & 66 deletions .github/workflows/codeql-analysis.yml

This file was deleted.