Skip to content

Commit

Permalink
Adds Danger. Disables tag flow
Browse files Browse the repository at this point in the history
  • Loading branch information
NQuinn27 committed Oct 6, 2023
1 parent 92dbb40 commit 0c455a6
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 6 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/danger.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Danger

on:
pull_request:
types:
- opened
- edited
- synchronize

jobs:
danger:
runs-on: ubuntu-latest
name: "Run Danger"
steps:
- uses: actions/checkout@v1
- name: Danger
uses: docker://ghcr.io/danger/danger-swift:3.13.0
with:
args: --failOnErrors --no-publish-check --remove-previous-comments
env:
GITHUB_TOKEN: ${{ github.token }}
12 changes: 6 additions & 6 deletions .github/workflows/post-release-merge.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: Post PR Merge

on:
pull_request:
# Patterns matched against refs/heads
branches:
- release/next
types: [ closed ]
on: workflow_dispatch
# pull_request:
# # Patterns matched against refs/heads
# branches:
# - release/next
# types: [ closed ]

jobs:
release_merge:
Expand Down
19 changes: 19 additions & 0 deletions Dangerfile.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import Danger
import Foundation

let danger = Danger()
let pr = danger.github.pullRequest
let isReleasePr = pr.head.ref.hasPrefix("release")

func isConventionalCommitTitle() -> Bool {
// Commitizen-compatible conventional commit titles
pr.title.hasPrefix("BREAKING CHANGE:") ||
pr.title.hasPrefix("chore:") ||
pr.title.hasPrefix("fix:") ||
pr.title.hasPrefix("feat:")
}

if !isReleasePr && !isConventionalCommitTitle() {
fail("Please use a conventional commit title for this PR. See [Conventional Commits and SemVer](https://www.notion.so/primerio/Automating-Version-Bumping-and-Changelog-Creation-c13e32fea11447069dea76f966f4b0fb?pvs=4#c55764aa2f2748eb988d581a456e61e7)")
}

0 comments on commit 0c455a6

Please sign in to comment.