Skip to content

Commit

Permalink
Standardize workflows to appear more similar to github-config
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuatcasey authored and ryanmoran committed Aug 30, 2022
1 parent 7dfd95a commit 1224515
Show file tree
Hide file tree
Showing 12 changed files with 123 additions and 42 deletions.
15 changes: 9 additions & 6 deletions .github/.patch_files
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
.github/.patch_files
.github/.syncignore
.github/CODEOWNERS
.github/dependabot.yml
.github/labels.yml
.github/workflows/check-pr-labels.yml
.github/CODEOWNERS
.github/workflows
.github/workflows/approve-bot-pr.yml
.github/workflows/codeql-analysis.yml
.github/workflows/label-pr.yml
.github/workflows/lint.yml
.github/workflows/synchronize-labels.yml
.github/workflows/create-draft-release.yml
.github/workflows/test-pull-request.yml
.github/workflows/lint-yaml.yml
.github/workflows/synchronize-labels.yml
.github/workflows/label-pr.yml
.github/.syncignore
.github/dependabot.yml
.gitignore
LICENSE
NOTICE
Expand Down
1 change: 1 addition & 0 deletions .github/.syncignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CODEOWNERS
1 change: 1 addition & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
version: 2
updates:
- package-ecosystem: gomod
Expand Down
18 changes: 18 additions & 0 deletions .github/labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,21 @@
- name: documentation
description: This issue relates to writing documentation
color: D4C5F9
- name: semver:major
description: A change requiring a major version bump
color: 6b230e
- name: semver:minor
description: A change requiring a minor version bump
color: cc6749
- name: semver:patch
description: A change requiring a patch version bump
color: f9d0c4
- name: good first issue
description: A good first issue to get started with
color: d3fc03
- name: "failure:release"
description: An issue filed automatically when a release workflow run fails
color: f00a0a
- name: "failure:push"
description: An issue filed automatically when a push buildpackage workflow run fails
color: f00a0a
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Approve Bot PRs
name: Approve Bot PRs and Enable Auto-Merge

on:
workflow_run:
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ on:
push:
branches:
- main
- v2
- v*
pull_request:
branches:
- main
- v2
- v*
schedule:
- cron: '0 0 * * *' # Once a day at midnight
- cron: '0 0 * * *' # Once a day at midnight

jobs:
analyze:
Expand All @@ -25,15 +25,15 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Initialize CodeQL
uses: github/codeql-action/init@v1
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}

- name: Autobuild
uses: github/codeql-action/autobuild@v1
uses: github/codeql-action/autobuild@v2

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
uses: github/codeql-action/analyze@v2
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
name: Create Release
name: Create or Update Draft Release

on:
push:
branches:
- v2
- main
- v*
repository_dispatch:
types: [ version-bump ]
workflow_dispatch:
inputs:
version:
Expand All @@ -22,7 +25,7 @@ jobs:
with:
go-version: 1.18.x
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Run Unit Tests
run: go test -v -count=1 ./...

Expand All @@ -36,7 +39,7 @@ jobs:
with:
go-version: 1.18.x
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* || true
- name: Reset Draft Release
id: reset
Expand All @@ -60,7 +63,7 @@ jobs:
tag="${{ steps.semver.outputs.tag }}"
fi
echo "::set-output name=tag::${tag}"
- name: Create Draft Release
- name: Create Release
uses: paketo-buildpacks/github-config/actions/release/create@main
with:
repo: ${{ github.repository }}
Expand All @@ -69,3 +72,22 @@ jobs:
target_commitish: ${{ github.sha }}
name: v${{ steps.tag.outputs.tag }}
draft: true

failure:
name: Alert on Failure
runs-on: ubuntu-latest
needs: [ unit, release ]
if: ${{ always() && needs.unit.result == 'failure' || needs.release.result == 'failure' }}
steps:
- name: File Failure Alert Issue
uses: paketo-buildpacks/github-config/actions/issue/file@main
with:
token: ${{ secrets.GITHUB_TOKEN }}
repo: ${{ github.repository }}
label: "failure:release"
comment_if_exists: true
issue_title: "Failure: Create Draft Release workflow"
issue_body: |
Create Draft Release workflow [failed](https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}).
comment_body: |
Another failure occurred: https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}
2 changes: 1 addition & 1 deletion .github/workflows/label-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on:
pull_request_target:
branches:
- main
- v2
- v*
types:
- synchronize
- opened
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/lint-yaml.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Lint Workflows

on:
pull_request:
paths:
- '.github/**.yml'
- '.github/**.yaml'

jobs:
lintYaml:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

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

- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: 3.8

- name: Install yamllint
run: pip install yamllint

- name: Lint YAML files
run: yamllint ./.github -c github-config/.github/.yamllint
27 changes: 15 additions & 12 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,27 @@ on:
push:
branches:
- main
- v2
- v*
pull_request:
branches:
- main
- v2
- v*

jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: 1.18.x
- name: golangci-lint
uses: golangci/golangci-lint-action@v2.3.0
with:
version: latest
args: "--timeout 3m0s"
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: 1.18.x

- name: Checkout
uses: actions/checkout@v3

- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: latest
args: --timeout 3m0s
17 changes: 9 additions & 8 deletions .github/workflows/synchronize-labels.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
name: Synchronize Labels

on:
push:
branches:
- main
- v2
- main
- v*
paths:
- .github/labels.yml
- .github/labels.yml

jobs:
synchronize:
name: Synchronize Labels
runs-on:
- ubuntu-latest
- ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: micnncim/action-label-syncer@v1
env:
GITHUB_TOKEN: ${{ github.token }}
- uses: actions/checkout@v3
- uses: micnncim/action-label-syncer@v1
env:
GITHUB_TOKEN: ${{ github.token }}
6 changes: 4 additions & 2 deletions .github/workflows/test-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
pull_request:
branches:
- main
- v2
- v*

jobs:
unit:
Expand All @@ -15,8 +15,10 @@ jobs:
uses: actions/setup-go@v3
with:
go-version: 1.18.x

- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Run Unit Tests
run: go test -v -count=1 ./...

Expand Down

0 comments on commit 1224515

Please sign in to comment.