Skip to content

Commit

Permalink
develop: try danger
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikita Korobeinikov committed Mar 22, 2021
1 parent ba13258 commit b566522
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 14 deletions.
35 changes: 21 additions & 14 deletions .github/workflows/Lint.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,28 @@
name: SwiftLint
name: Danger

on:
pull_request:
paths:
- '.github/workflows/Lint.yml'
- '.swiftlint.yml'
- 'Sources/**/*.swift'

jobs:
SwiftLint:
danger:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' # if only run pull request when multiple trigger workflow
steps:
- uses: actions/checkout@v1
- name: Fetch base ref
run: git fetch --no-tags --prune --depth=1 origin ${{ github.base_ref }}
- name: GitHub Action for SwiftLint (Only files changed in the PR)
uses: norio-nomura/[email protected]
env:
WORKING_DIRECTORY: Sources
DIFF_BASE: origin/${{ github.base_ref }}
- uses: actions/checkout@v2
- uses: actions/setup-ruby@v1
with:
ruby-version: '2.6'
- uses: actions/cache@v1
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('Gemfile') }} # change your gemfile path
restore-keys: |
${{ runner.os }}-gems-
- uses: MeilCli/danger-action@v5
with:
plugins_file: 'Gemfile'
install_path: 'vendor/bundle'
danger_file: 'Dangerfile'
danger_id: 'danger-pr'
env:
DANGER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7 changes: 7 additions & 0 deletions Dangerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@


swiftlint.config_file = '.swiftlint.yml'
swiftlint.max_num_violations = 20
swiftlint.lint_files inline_mode: true

the_coding_love.random
13 changes: 13 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
source "https://rubygems.org"

# Ensure github repositories are fetched using HTTPS
git_source(:github) do |repo_name|
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
puts(repo_name)
"https://github.com/#{repo_name}.git"
end if Gem::Version.new(Bundler::VERSION) < Gem::Version.new('2')

gem 'cocoapods', "1.7.3"
gem 'danger'
gem 'danger-the_coding_love'
gem 'danger-swiftlint'

0 comments on commit b566522

Please sign in to comment.