-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
85 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
node_modules | ||
.github | ||
danger |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |