Skip to content

Commit

Permalink
Setup CI
Browse files Browse the repository at this point in the history
  • Loading branch information
handelce committed Sep 9, 2023
1 parent ff4f400 commit 1038d1e
Show file tree
Hide file tree
Showing 6 changed files with 85 additions and 6 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/tyche-danger.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Danger

on:
pull_request:
types: [opened, reopened, edited, synchronize]

jobs:
main:
name: Danger CI
runs-on: ubuntu-latest
steps:
- name: git checkout
uses: actions/checkout@v3

- name: ruby setup
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2.2
bundler-cache: true

- name: Run Danger
if: github.event_name == 'pull_request'
run: |
gem install danger
gem install danger-commit_lint
bundle exec danger --dangerfile=Dangerfile --danger_id=danger-pr
env:
DANGER_GITHUB_API_TOKEN: ${{ secrets.DANGER_GITHUB_API_TOKEN }}
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@ on: pull_request
name: Inspections
jobs:
runPHPCSInspection:
name: Run PHPCS inspection
name: PHPCS
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Run PHPCS inspection
uses: rtCamp/[email protected]

- name: Run PHPCS
uses: rtCamp/action-phpcs-code-review@v3
env:
GH_BOT_TOKEN: ${{ secrets.GH_BOT_TOKEN }}
SKIP_FOLDERS: "tests,.github"
GH_BOT_TOKEN: ${{ secrets.DANGER_GITHUB_API_TOKEN }}
with:
args: "WordPress,WordPress-Core,WordPress-Docs"
9 changes: 9 additions & 0 deletions .vipgoci_options
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"skip-draft-prs":true,
"lint-modified-files-only":true,
"phpcs":true,
"phpcs-severity": 5,
"skip-draft-prs":true,
"phpcs-sniffs-exclude":["WordPress.Files.FileName"],
"results-comments-sort":true
}
3 changes: 3 additions & 0 deletions .vipgoci_phpcs_skip_folders
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
.github
danger
31 changes: 31 additions & 0 deletions Dangerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
github.dismiss_out_of_range_messages

warn "This PR is quite big! It contains over 5000 lines of code. Consider splitting it into separate PRs." if git.lines_of_code > 5000

failure "Please provide a summary in the PR description textfield" if github.pr_body.length < 2

failure "This PR does not have any assignee. Please assign yourself if you are the author of this PR." unless github.pr_json["assignee"]

failure "This PR has not been assigned to a reviewer. Every PR must be reviewed by a Senior Developer @ Tyche Softwares." unless github.pr_json["reviewer"]

failure "This PR has not been assigned to a milestone." unless github.pr_json["milestone"]

if git.modified_files.empty? && git.added_files.empty? && git.deleted_files.empty?
failure "This PR has no changes at all, this is likely an issue during development."
end

# Verify if PR title contains issue numbers
fix = github.pr_body.scan(/\[(\w{1,3} #\d+)\]/)
if fix.empty?
failure "This PR does not have any issue number in the description. (e.g. Fix #10)"
end

if github.pr_body.include? "do-not-scan"
failure "Skipping of PHPCS Scan is highly discouraged."
end

commit_lint.check warn: :all

todoist.message = "There are still some things to do in this PR."
todoist.warn_for_todos
todoist.print_todos_table
7 changes: 7 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
source "https://rubygems.org"

git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }

gem 'danger'
gem 'danger-commit_lint'
gem 'danger-todoist'

0 comments on commit 1038d1e

Please sign in to comment.