https://github.com/alignable/checkie
GitHub action to leave annotations in PRs based on rules
https://github.com/alignable/checkie
Last synced: 20 days ago
JSON representation
GitHub action to leave annotations in PRs based on rules
- Host: GitHub
- URL: https://github.com/alignable/checkie
- Owner: Alignable
- Created: 2022-05-17T19:09:06.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2026-02-26T21:31:19.000Z (4 months ago)
- Last Synced: 2026-02-27T03:35:53.103Z (4 months ago)
- Language: Ruby
- Size: 52.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Setup
1. Create github action
```yml
jobs:
checkie:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./.github/checkie
steps:
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
with:
working-directory: ./.github/checkie
bundler-cache: false
- run: bundle install
- run: bundle exec ruby main.rb $PR_URL $ACTION
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_URL: ${{ github.event.pull_request.url }}
ACTION: ${{ github.event.action }}
```
2. Create project in `.github/checkie` with Gemfile:
```ruby
gem "checkie", github: 'Alignable/checkie'
```
3. Create main file:
```ruby
require './rules'
# Run from command line with bundle exec ruby main.rb PR_URL ACTION_TYPE
run(ARGV[0].dup, ARGV[1].dup)
```
4. Write rules in that project in `rules.rb`. More info on writing rules in RULES.md example:
```ruby
file_rule :hardcoded_url,
"Looks like you might have a hardcoded url http:// - should that be an ENV variable?"
matching("app/facades/**.rb") do |changes, files|
changes.added(/https?\:\/\//) do
check(:hardcoded_url)
end
end
```