ci: migrate to github actions #8
Workflow file for this run
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
name: Vulnerabilities | |
on: [pull_request] | |
jobs: | |
vulnerabilities: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ruby/setup-ruby@v1 | |
with: | |
bundler-cache: true | |
- name: Rails application check | |
id: rails-check | |
run: | | |
if [ -f config/application.rb ]; then | |
echo "RAILS_APP=true" >> "$GITHUB_OUTPUT" | |
fi | |
- name: Brakeman | |
env: | |
RAILS_APP: ${{ steps.rails-check.outputs.RAILS_APP }} | |
# Brakeman has dropped support for Ruby 2, so we need to use an older version until we upgrade Ruby | |
BRAKEMAN_VERSION: ~> 5.0 | |
run: | | |
if [ -z "$RAILS_APP" ]; then | |
echo "Not a Rails application" | |
exit 0 | |
fi | |
echo "source 'https://rubygems.org'" > Gemfile.brakeman | |
if [ -n "$BRAKEMAN_VERSION" ]; then | |
echo "gem 'brakeman', '$BRAKEMAN_VERSION'" >> Gemfile.brakeman | |
else | |
echo "gem 'brakeman'" >> Gemfile.brakeman | |
fi | |
bundle install --gemfile Gemfile.brakeman | |
bundle exec --gemfile Gemfile.brakeman brakeman --exit-on-warn | |
- name: Bundler Audit | |
run: | | |
gem install bundler-audit | |
bundle audit check --update |