Skip to content

Commit

Permalink
/.github/{markdown-templates, workflows}: split format and verify wor…
Browse files Browse the repository at this point in the history
…kflows, update bump depedency workflow
  • Loading branch information
coffeegoddd committed May 6, 2021
1 parent 3fa5d64 commit ce42242
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 70 deletions.
4 changes: 1 addition & 3 deletions .github/markdown-templates/dep-bump.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@ The initial changes contained in this PR were produced by `go get`ing the depend

```
$ cd ./go
$ go get -u github.com/dolthub/<dependency>/go@<commit>
$ go get github.com/dolthub/<dependency>/go@<commit>
```

### Before Merging

This PR must have passing CI and a review before merging.

If this PR has passing CI, a `check-suite-ok` label will automatically be applied to it.
60 changes: 41 additions & 19 deletions .github/workflows/bump-dependency.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,16 @@ jobs:
open-bump-pr:
needs: [get-label, stale-bump-prs]
name: Open Bump PR
runs-on: macos-latest
runs-on: ubuntu-18.04
outputs:
latest-pr: ${{ steps.latest-pr.outputs.pr_url }}
steps:
- uses: actions/checkout@v2
with:
token: ${{ secrets.REPO_ACCESS_TOKEN || secrets.GITHUB_TOKEN }}
- name: Bump dependency
working-directory: go
run: |
go get github.com/dolthub/${{ github.event.client_payload.dependency }}@${{ github.event.client_payload.head_commit_sha }}
go mod tidy
run: go get github.com/dolthub/${{ github.event.client_payload.dependency }}@${{ github.event.client_payload.head_commit_sha }}
- name: Get Assignee and Reviewer
id: get_reviewer
run: |
Expand Down Expand Up @@ -142,21 +142,43 @@ jobs:
const pull = JSON.parse(PULL);
for (const label of pull.labels) {
if (label.name === "check-suite-ok") {
await github.issues.createComment({
issue_number: pull.number,
owner,
repo,
body: `This PR has been superseded by ${SUPERSEDED_BY}`
});
await github.pulls.update({
owner,
repo,
pull_number: pull.number,
state: 'closed',
});
break;
}
if (label.name === "keep-alive") {
process.exit(0);
}
}
const checkSuiteRes = github.checks.listSuitesForRef({
owner,
repo,
ref: pull.head.ref,
});
console.log(checkSuiteRes);
if (checkSuiteRes.data) {
let successes = 0;
for (const suite of checkSuiteRes.data.check_suites) {
if (suite.status === "completed" && suite.conclusion === "success") {
successes += 1;
}
}
if (successes == checkSuiteRes.data.total_count) {
await github.issues.createComment({
issue_number: pull.number,
owner,
repo,
body: `This PR has been superseded by ${SUPERSEDED_BY}`
});
await github.pulls.update({
owner,
repo,
pull_number: pull.number,
state: 'closed',
});
}
}
process.exit(0);
Expand Down
48 changes: 0 additions & 48 deletions .github/workflows/ci-check-repo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,50 +5,7 @@ on:
branches: [ master ]

jobs:
format:
name: Format PR
runs-on: ubuntu-18.04
outputs:
has-changes: ${{ steps.detect-changes.outputs.has-changes }}
commit: ${{ steps.get_commit.outputs.commit }}
steps:
- name: Setup Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.15
- uses: actions/checkout@v2
- name: Install goimports
run: go get golang.org/x/tools/cmd/goimports
- 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: "."
- name: Get commit
id: get_commit
if: ${{ steps.detect-changes.outputs.has-changes == 'true' }}
run: |
commit=$(git rev-parse HEAD)
echo "::set-output name=commit::$commit"
verify:
needs: format
name: Verify format and committers
runs-on: ubuntu-18.04
steps:
Expand All @@ -57,11 +14,6 @@ jobs:
with:
go-version: ^1.15
- uses: actions/checkout@v2
if: ${{ needs.format.outputs.has-changes == 'true' && needs.format.outputs.commit != '' }}
with:
ref: ${{ needs.format.outputs.commit }}
- uses: actions/checkout@v2
if: ${{ needs.format.outputs.has-changes != 'true' }}
- name: Check all
working-directory: ./go
# Keep this in sync with //go/utils/prepr/prepr.sh.
Expand Down
41 changes: 41 additions & 0 deletions .github/workflows/ci-format-repo.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Format PR

on:
pull_request:
branches: [ master ]

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.15
- uses: actions/checkout@v2
with:
token: ${{ secrets.REPO_ACCESS_TOKEN || secrets.GITHUB_TOKEN }}
- name: Install goimports
run: go get golang.org/x/tools/cmd/goimports
- 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: "."

0 comments on commit ce42242

Please sign in to comment.