Files
dolt/.github/workflows/ci-format-repo.yaml
T

51 lines
1.5 KiB
YAML

name: Format PR
on:
pull_request:
branches: [ main ]
workflow_dispatch:
concurrency:
group: ci-format-repo-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
format:
name: Format PR
runs-on: ubuntu-18.04
steps:
- name: Setup Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.18
- uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.ref || github.ref }}
token: ${{ secrets.REPO_ACCESS_TOKEN || secrets.GITHUB_TOKEN }}
- name: Run go mod tidy
run: go mod tidy
working-directory: ./go
- name: Install goimports
run: go install golang.org/x/tools/cmd/goimports@latest
- name: Format repo and update licenses
working-directory: ./go
run: |
./utils/repofmt/format_repo.sh
./Godeps/update.sh
env:
BRANCH_NAME: ${{ github.head_ref }}
CHANGE_TARGET: ${{ github.base_ref }}
- name: Changes detected
id: detect-changes
run: |
changes=$(git status --porcelain)
if [ ! -z "$changes" ]; then
echo "::set-output name=has-changes::true"
fi
- uses: EndBug/add-and-commit@v7
if: ${{ steps.detect-changes.outputs.has-changes == 'true' }}
with:
message: "[ga-format-pr] Run go/utils/repofmt/format_repo.sh and go/Godeps/update.sh"
add: "."
cwd: "."