Sha256: 0d14d9233f533f2176a37487978e045ce2cb249cce1aa7d07857b004b79c6cdc

Contents?: true

Size: 1.86 KB

Versions: 3

Compression:

Stored size: 1.86 KB

Contents

# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json

on:
  workflow_call:
    inputs:
      remove-previous-comments:
        description: Configures Danger to always remove previous comments and add a new one instead of editing the same comment.
        default: false
        type: boolean
        required: false
      cancel-running-jobs:
        description: Cancel currently in progress jobs when new ones are added.
        default: true
        type: boolean
        required: false
    secrets:
      github-token:
        required: true

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: ${{ inputs.cancel-running-jobs }}

jobs:
  dangermattic:
    runs-on: ubuntu-latest
    steps:
      - name: 📥 Checkout Repo
        uses: actions/checkout@v4
        with:
          fetch-depth: 100
      - name: 💎 Ruby Setup
        uses: ruby/setup-ruby@v1
        with:
          bundler-cache: true
      - name: ☢️ Danger PR Check
        env:
          PR_URL: ${{ github.event.pull_request.html_url }}
          READ_ONLY_MODE: ${{ github.event.pull_request.head.repo.fork || github.actor == 'dependabot[bot]' }}
          REMOVE_PREVIOUS_COMMENTS: ${{ inputs.remove-previous-comments }}
          DANGER_GITHUB_API_TOKEN: ${{ secrets.github-token || secrets.GITHUB_TOKEN }}
        run: |
          echo "--- 🏃 Running Danger: PR Check"

          if [ "$READ_ONLY_MODE" = true ]; then
            danger_output=$(bundle exec danger pr "$PR_URL" --verbose)

            echo "$danger_output"

            if echo "$danger_output" | grep -q "Errors:"; then
              echo "Danger encountered errors."
              exit 1
            fi
          else
            bundle exec danger --fail-on-errors=true --danger_id=pr-check $([ "$REMOVE_PREVIOUS_COMMENTS" = true ] && echo "--remove-previous-comments")
          fi

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
danger-dangermattic-1.2.2 .github/workflows/reusable-run-danger.yml
danger-dangermattic-1.2.1 .github/workflows/reusable-run-danger.yml
danger-dangermattic-1.2.0 .github/workflows/reusable-run-danger.yml