Skip to content

Commit

Permalink
Update bootstrapper workflows and dependabot config (#53)
Browse files Browse the repository at this point in the history
* update bootstrapper workflows and dependabot
* update template cnb go.mod with dependabot
* Update template cnb scripts
* update top level workflows
  • Loading branch information
sophiewigmore committed Mar 15, 2021
1 parent adaa184 commit e0c9356
Show file tree
Hide file tree
Showing 24 changed files with 657 additions and 323 deletions.
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
version: 2
updates:
- package-ecosystem: gomod
directory: "/"
schedule:
interval: daily
- package-ecosystem: gomod
directory: "/template-cnb"
schedule:
interval: daily
open-pull-requests-limit: 10
46 changes: 46 additions & 0 deletions .github/workflows/auto-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Auto-Merge

on:
pull_request_review:
types:
- submitted

jobs:
automerge:
name: Merge or Rebase
if: ${{ github.event.review.user.login == 'paketo-bot-reviewer' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Fetch Pull Request Details
id: pull_request
env:
NUMBER: ${{ github.event.pull_request.number }}
GITHUB_TOKEN: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }}
run: |
payload="$(
curl "https://api.github.com/repos/${GITHUB_REPOSITORY}/pulls/${NUMBER}" \
--silent \
--location \
--header "Authorization: token ${GITHUB_TOKEN}"
)"
echo "::set-output name=mergeable_state::$(echo "${payload}" | jq -r -c .mergeable_state)"
- name: Merge
if: ${{ steps.pull_request.outputs.mergeable_state == 'clean' }}
uses: paketo-buildpacks/github-config/actions/pull-request/merge@main
with:
user: paketo-bot
token: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }}
number: ${{ github.event.pull_request.number }}

- name: Rebase
if: ${{ steps.pull_request.outputs.mergeable_state == 'behind' }}
uses: paketo-buildpacks/github-config/actions/pull-request/rebase@main
with:
user: paketo-bot
token: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }}
number: ${{ github.event.pull_request.number }}
36 changes: 0 additions & 36 deletions .github/workflows/receive-github-config-updates.yml

This file was deleted.

77 changes: 77 additions & 0 deletions .github/workflows/test-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Test Pull Request

on:
pull_request:
branches:
- main

jobs:
unit:
name: Unit Tests
runs-on: ubuntu-latest
steps:
- name: Setup Go
uses: actions/setup-go@v1
with:
go-version: 1.14

- name: Checkout
uses: actions/checkout@v2

- name: Run Unit Tests
run: ./scripts/unit.sh

integration:
name: Integration Tests
runs-on: ubuntu-latest
needs: unit
steps:
- name: Setup Go
uses: actions/setup-go@v1
with:
go-version: 1.14

- name: Checkout
uses: actions/checkout@v2

- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* || true

- name: Run Integration Tests
run: ./scripts/integration.sh
env:
GIT_TOKEN: ${{ github.token }}

approve:
name: Approve Bot PRs
if: ${{ github.event.pull_request.user.login == 'paketo-bot' || github.event.pull_request.user.login == 'dependabot[bot]' }}
runs-on: ubuntu-latest
needs: integration
steps:
- name: Check Commit Verification
id: unverified-commits
uses: paketo-buildpacks/github-config/actions/pull-request/check-unverified-commits@main
with:
token: ${{ secrets.PAKETO_BOT_REVIEWER_GITHUB_TOKEN }}
repo: ${{ github.repository }}
number: ${{ github.event.number }}

- name: Check for Human Commits
id: human-commits
uses: paketo-buildpacks/github-config/actions/pull-request/check-human-commits@main
with:
token: ${{ secrets.PAKETO_BOT_REVIEWER_GITHUB_TOKEN }}
repo: ${{ github.repository }}
number: ${{ github.event.number }}

- name: Checkout
if: steps.human-commits.outputs.human_commits == 'false' && steps.unverified-commits.outputs.unverified_commits == 'false'
uses: actions/checkout@v2

- name: Auto Approve
if: steps.human-commits.outputs.human_commits == 'false' && steps.unverified-commits.outputs.unverified_commits == 'false'
uses: paketo-buildpacks/github-config/actions/pull-request/approve@main
with:
user: paketo-bot-reviewer
token: ${{ secrets.PAKETO_BOT_REVIEWER_GITHUB_TOKEN }}
author: ${{ github.event.pull_request.user.login }}
number: ${{ github.event.number }}
37 changes: 0 additions & 37 deletions .github/workflows/test.yml

This file was deleted.

60 changes: 60 additions & 0 deletions .github/workflows/update-github-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Update shared github-config

on:
schedule:
- cron: '*/15 * * * *'
workflow_dispatch: {}

jobs:
build:
name: Create PR to update shared files
runs-on: ubuntu-latest
steps:

- name: Checkout
uses: actions/checkout@v2
with:
token: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }}

- name: Checkout github-config
uses: actions/checkout@v2
with:
repository: paketo-buildpacks/github-config
path: github-config

- name: Checkout Branch
uses: paketo-buildpacks/github-config/actions/pull-request/checkout-branch@main
with:
branch: automation/github-config/update

- name: Run the sync action for template CNB
uses: paketo-buildpacks/github-config/actions/sync@main
with:
workspace: /github/workspace/template-cnb
config: /github/workspace/github-config/implementation

- name: Cleanup
run: rm -rf github-config

- name: Commit
id: commit
uses: paketo-buildpacks/github-config/actions/pull-request/create-commit@main
with:
message: "Updating github-config"
pathspec: "."
keyid: ${{ secrets.PAKETO_BOT_GPG_SIGNING_KEY_ID }}
key: ${{ secrets.PAKETO_BOT_GPG_SIGNING_KEY }}

- name: Push Branch
if: ${{ steps.commit.outputs.commit_sha != '' }}
uses: paketo-buildpacks/github-config/actions/pull-request/push-branch@main
with:
branch: automation/github-config/update

- name: Open Pull Request
if: ${{ steps.commit.outputs.commit_sha != '' }}
uses: paketo-buildpacks/github-config/actions/pull-request/open@main
with:
token: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }}
title: "Updates github-config"
branch: automation/github-config/update
1 change: 1 addition & 0 deletions bootstrapper/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ func Bootstrap(templateWriter TemplateWriter, buildpack, templatePath, outputPat

if strings.HasPrefix(path, filepath.Join(outputPath, "bin")) ||
strings.HasPrefix(path, filepath.Join(outputPath, ".github")) ||
strings.HasPrefix(path, filepath.Join(outputPath, "scripts")) ||
strings.HasPrefix(path, filepath.Join(outputPath, ".bin")) {
return nil
}
Expand Down
46 changes: 46 additions & 0 deletions template-cnb/.github/workflows/auto-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Auto-Merge

on:
pull_request_review:
types:
- submitted

jobs:
automerge:
name: Merge or Rebase
if: ${{ github.event.review.user.login == 'paketo-bot-reviewer' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Fetch Pull Request Details
id: pull_request
env:
NUMBER: ${{ github.event.pull_request.number }}
GITHUB_TOKEN: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }}
run: |
payload="$(
curl "https://api.github.com/repos/${GITHUB_REPOSITORY}/pulls/${NUMBER}" \
--silent \
--location \
--header "Authorization: token ${GITHUB_TOKEN}"
)"
echo "::set-output name=mergeable_state::$(echo "${payload}" | jq -r -c .mergeable_state)"
- name: Merge
if: ${{ steps.pull_request.outputs.mergeable_state == 'clean' || steps.pull_request.outputs.mergeable_state == 'unstable' }}
uses: paketo-buildpacks/github-config/actions/pull-request/merge@main
with:
user: paketo-bot
token: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }}
number: ${{ github.event.pull_request.number }}

- name: Rebase
if: ${{ steps.pull_request.outputs.mergeable_state == 'behind' }}
uses: paketo-buildpacks/github-config/actions/pull-request/rebase@main
with:
user: paketo-bot
token: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }}
number: ${{ github.event.pull_request.number }}
11 changes: 7 additions & 4 deletions template-cnb/.github/workflows/create-draft-release.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
name: Create Draft Release
name: Create or Update Draft Release

on:
push:
branches:
- main
repository_dispatch:
types: [ version-bump ]
workflow_dispatch: {}

jobs:
unit:
Expand All @@ -13,7 +16,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v1
with:
go-version: 1.14
go-version: 1.16
- name: Checkout
uses: actions/checkout@v2
- name: Run Unit Tests
Expand All @@ -27,12 +30,12 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v1
with:
go-version: 1.14
go-version: 1.16
- name: Checkout
uses: actions/checkout@v2
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* || true
- name: Run Integration Tests
run: ./scripts/integration.sh
run: ./scripts/integration.sh --use-token
env:
GIT_TOKEN: ${{ github.token }}

Expand Down
4 changes: 2 additions & 2 deletions template-cnb/.github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: golangci-lint
uses: golangci/golangci-lint-action@v1.2.1
uses: golangci/golangci-lint-action@v2.3.0
with:
version: v1.27
version: v1.32.2

0 comments on commit e0c9356

Please sign in to comment.