mirror of
https://github.com/dolthub/dolt.git
synced 2026-04-24 03:16:12 -05:00
/.github/workflows/ci-check-repo.yaml: fix formatting so it can run on fork prs
This commit is contained in:
@@ -73,9 +73,40 @@ jobs:
|
||||
echo "$diff"
|
||||
exit 1
|
||||
fi
|
||||
format:
|
||||
get-artifacts:
|
||||
needs: verify
|
||||
if: ${{ needs.verify.outputs.format == 'true' }}
|
||||
name: Get artifacts
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Setup Go 1.x
|
||||
uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: ^1.19
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
ref: "main"
|
||||
repository: "dolthub/dolt"
|
||||
submodules: true
|
||||
- name: Copy script
|
||||
working-directory: ./go/utils/repofmt
|
||||
run: cp format_repo.sh _format_repo.sh
|
||||
- name: Build go deps tool
|
||||
working-directory: go/utils/3pdeps
|
||||
run: go build .
|
||||
- uses: actions/upload-artifact@v3
|
||||
if: ${{ steps.should_format.outputs.format == 'true' }}
|
||||
with:
|
||||
name: update-godeps-tool
|
||||
path: go/utils/3pdeps/3pdeps
|
||||
- uses: actions/upload-artifact@v3
|
||||
if: ${{ steps.should_format.outputs.format == 'true' }}
|
||||
with:
|
||||
name: format-code-script
|
||||
path: go/utils/repofmt/_format_repo.sh
|
||||
format:
|
||||
needs: [verify, get-artifacts]
|
||||
if: ${{ needs.verify.outputs.format == 'true' }}
|
||||
name: Format PR
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
@@ -87,20 +118,39 @@ jobs:
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.ref || github.ref }}
|
||||
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
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
|
||||
- uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: format-code-script
|
||||
path: go/utils/repofmt
|
||||
- uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: update-godeps-tool
|
||||
path: go
|
||||
- name: Format repo
|
||||
working-directory: ./go
|
||||
run: |
|
||||
./utils/repofmt/format_repo.sh
|
||||
./Godeps/update.sh
|
||||
chmod +x ./utils/repofmt/_format_repo.sh
|
||||
./utils/repofmt/_format_repo.sh
|
||||
env:
|
||||
BRANCH_NAME: ${{ github.head_ref }}
|
||||
CHANGE_TARGET: ${{ github.base_ref }}
|
||||
- name: Update Go deps
|
||||
working-directory: ./go
|
||||
run: |
|
||||
chmod +x ./3pdeps
|
||||
( go list -deps -json ./cmd/dolt/. && \
|
||||
GOOS=windows go list -deps -json ./cmd/dolt/. ) \
|
||||
| ./3pdeps > ./Godeps/LICENSES
|
||||
- name: Remove artifacts
|
||||
run: |
|
||||
rm go/3pdeps
|
||||
rm go/utils/repofmt/_format_repo.sh
|
||||
- name: Changes detected
|
||||
id: detect-changes
|
||||
run: |
|
||||
|
||||
Reference in New Issue
Block a user