diff --git a/.github/markdown-templates/dep-bump.md b/.github/markdown-templates/dep-bump.md index 0e6c105202..a066970971 100644 --- a/.github/markdown-templates/dep-bump.md +++ b/.github/markdown-templates/dep-bump.md @@ -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//go@ +$ go get github.com/dolthub//go@ ``` ### 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. diff --git a/.github/workflows/bump-dependency.yaml b/.github/workflows/bump-dependency.yaml index c611a1312f..c9a437a47f 100644 --- a/.github/workflows/bump-dependency.yaml +++ b/.github/workflows/bump-dependency.yaml @@ -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: | @@ -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); diff --git a/.github/workflows/ci-check-repo.yaml b/.github/workflows/ci-check-repo.yaml index f67bb3e5b5..b09066d1d9 100644 --- a/.github/workflows/ci-check-repo.yaml +++ b/.github/workflows/ci-check-repo.yaml @@ -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: @@ -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. diff --git a/.github/workflows/ci-format-repo.yaml b/.github/workflows/ci-format-repo.yaml new file mode 100644 index 0000000000..036e1d6166 --- /dev/null +++ b/.github/workflows/ci-format-repo.yaml @@ -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: "."