From b56652267f32ed712c131b6ccead128ad8fb82af Mon Sep 17 00:00:00 2001 From: Nikita Korobeinikov Date: Mon, 22 Mar 2021 11:30:50 +0400 Subject: [PATCH] develop: try danger --- .github/workflows/Lint.yml | 35 +++++++++++++++++++++-------------- Dangerfile | 7 +++++++ Gemfile | 13 +++++++++++++ 3 files changed, 41 insertions(+), 14 deletions(-) create mode 100644 Dangerfile create mode 100644 Gemfile diff --git a/.github/workflows/Lint.yml b/.github/workflows/Lint.yml index 5e1241f..9cff03e 100644 --- a/.github/workflows/Lint.yml +++ b/.github/workflows/Lint.yml @@ -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/action-swiftlint@3.2.1 - 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 }} diff --git a/Dangerfile b/Dangerfile new file mode 100644 index 0000000..9d4d6a2 --- /dev/null +++ b/Dangerfile @@ -0,0 +1,7 @@ + + +swiftlint.config_file = '.swiftlint.yml' +swiftlint.max_num_violations = 20 +swiftlint.lint_files inline_mode: true + +the_coding_love.random diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..ffdd8e8 --- /dev/null +++ b/Gemfile @@ -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'