项目作者: MeilCli

项目描述 :
Execute danger action for GitHub Actions.
高级语言: TypeScript
项目地址: git://github.com/MeilCli/danger-action.git
创建时间: 2019-09-14T16:39:05Z
项目社区:https://github.com/MeilCli/danger-action

开源协议:MIT License

下载


danger-action

CI-Master
Execute danger action for GitHub Actions.

Required

This action must set-up Ruby and Bundler.

Recommendation: set up Ruby 2.6 or higher

Example

  1. name: CI
  2. on:
  3. pull_request:
  4. branches:
  5. - master
  6. jobs:
  7. danger:
  8. runs-on: ubuntu-latest
  9. if: github.event_name == 'pull_request' # if only run pull request when multiple trigger workflow
  10. steps:
  11. - uses: actions/checkout@v4
  12. - uses: ruby/setup-ruby@v1
  13. with:
  14. ruby-version: '2.6'
  15. - uses: actions/cache@v4
  16. with:
  17. path: vendor/bundle
  18. key: ${{ runner.os }}-gems-${{ hashFiles('Gemfile') }} # change your gemfile path
  19. restore-keys: |
  20. ${{ runner.os }}-gems-
  21. - uses: MeilCli/danger-action@v6
  22. with:
  23. plugins_file: 'Gemfile'
  24. install_path: 'vendor/bundle'
  25. danger_file: 'Dangerfile'
  26. danger_id: 'danger-pr'
  27. env:
  28. DANGER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}

You can also pin to a specific release version in the format @v6.x.x

input

  • danger_version
    • optional
    • version information with gem styled
    • default: >= 6.0.0
  • danger_version_file
    • optional
    • danger version file
    • default: .tool-versions
  • danger_version_file_format
    • optional
    • danger version file format. more detail
    • default: asdf
  • plugins_file
    • optional
    • gemfile path for danger plugin. if set plugins_file, action do not exec gem install danger
  • install_path
    • optional
    • bundle install path, Useful instead of bundle config path
  • danger_file
    • required
    • dangerfile path for running danger
  • danger_id
    • required
    • danger id is an identifier string, example(danger-pr, danger-CI, etc..)
  • fail_on_stderr_when_bundler
    • optional
    • action fail when bundler output stderr
    • default: false
  • fail_on_stderr_when_danger
    • optional
    • action fail when danger output stderr
    • default: false

env

  • DANGER_GITHUB_API_TOKEN
    • required
    • GitHub Token using by Danger
    • recommendation value: ${{ secrets.GITHUB_TOKEN }}

Additional Example

  1. name: CI
  2. on:
  3. pull_request:
  4. branches:
  5. - master
  6. jobs:
  7. danger:
  8. runs-on: ubuntu-latest
  9. if: github.event_name == 'pull_request' # if only run pull request when multiple trigger workflow
  10. steps:
  11. - uses: actions/checkout@v4
  12. - uses: ruby/setup-ruby@v1
  13. with:
  14. ruby-version: '2.6'
  15. - uses: actions/cache@v4
  16. with:
  17. path: vendor/bundle
  18. key: ${{ runner.os }}-gems-${{ hashFiles('.github/Gemfile') }} # change your gemfile path
  19. restore-keys: |
  20. ${{ runner.os }}-gems-
  21. - uses: MeilCli/danger-action@v6
  22. with:
  23. plugins_file: '.github/Gemfile'
  24. install_path: 'vendor/bundle'
  25. danger_file: '.github/Dangerfile'
  26. danger_id: 'danger-pr'
  27. env:
  28. DANGER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}

danger-action can escape path of Gemfile. so you can put Gemfile on no-current directory.

Attention: For repository OSS or using dependabot

github-actions token has not write permission at triggered by pull_request that created from forked repository or created by dependabot. This reason is for security

ref: Keeping your GitHub Actions and workflows secure: Preventing pwn requests

In this case, danger cannot use GitHub API because readonly token. And, Using pull_request_target is an option, but it have the security concerns.

If your needs is report of lint-result, recommending MeilCli/common-lint-reporter. Its action resolve this problem by using workflow_run.
see: More information

Contributes

Could you want to contribute?

see Contributing.md

License