File: lint.yml

package info (click to toggle)
ruby-view-component 4.5.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,832 kB
  • sloc: ruby: 8,385; sh: 166; makefile: 4
file content (93 lines) | stat: -rw-r--r-- 3,215 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
name: Lint

on: [pull_request]

permissions:
  contents: read

jobs:
  trailing-whitespace:
    runs-on: ubuntu-latest
    steps:
    - name: Checkout
      uses: actions/checkout@v4
    - name: Check for trailing whitespace
      uses: raisedevs/find-trailing-whitespace@restrict-to-plaintext-only
    - name: Check for merge conflicts
      run: git diff --check
      shell: bash
    - name: Ensure all files have newline at EOF
      uses: Logerfo/newline-action@0.0.4
      with:
        github-token: ${{ secrets.GITHUB_TOKEN }}
  prose:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4
      - name: Vale
        uses: errata-ai/vale-action@d89dee975228ae261d22c15adcd03578634d429c
        env:
          GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
  markdown:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@master
    - uses: avto-dev/markdown-lint@v1
      with:
        config: '.github/lint/markdown.json'
        args: 'docs/**/*.md'
  changedfiles:
    runs-on: ubuntu-latest
    # Map a step output to a job output
    outputs:
      all: ${{ steps.changes.outputs.all}}
      markdown: ${{ steps.changes.outputs.markdown }}
    steps:
      # Make sure we have some code to diff.
      - name: Checkout repository
        uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - name: Get changed files
        id: changes
        # Set outputs using the command.
        run: |
          echo "::set-output name=all::$(git diff --name-only --diff-filter=ACMRT ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} | xargs)"
          echo "::set-output name=markdown::$(git diff --name-only --diff-filter=ACMRT ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} | grep .md$ | xargs)"
  changelog:
    runs-on: ubuntu-latest
    # require the first job to have ran
    needs: changedfiles
    steps:
      - name: echo changed files
        run: |
          # Filter out Gemfile.lock files from changed files
          ALL_FILES="${{needs.changedfiles.outputs.all}}"
          FILTERED_FILES=$(echo "$ALL_FILES" | tr ' ' '\n' | grep -v '^Gemfile\.lock$' | grep -v '^docs/Gemfile\.lock$' | tr '\n' ' ' | xargs)

          # Only require changelog if there are other files changed
          if [[ -n "$FILTERED_FILES" ]] && [[ ! "${{needs.changedfiles.outputs.markdown}}" == *"CHANGELOG.md"* ]]; then
            echo "::error file=CHANGELOG.md,line=1,col=1::Please make sure that you add a docs/CHANGELOG.md entry to describe the changes in this pull request."
            exit 1
          fi
  lint:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@master
    - name: Setup Ruby
      uses: ruby/setup-ruby@v1
      with:
        ruby-version: 4.0
    - uses: actions/cache@v4
      with:
        path: vendor/bundle
        key: gems-build-rails-8-ruby-3.2-${{ hashFiles('**/Gemfile.lock') }}
    - name: Lint with Rubocop and ERB Lint
      run: |
        bundle config path vendor/bundle
        bundle update
        bundle exec standardrb -r "rubocop-md"
        bundle exec erb_lint --lint-all
      env:
        RAILS_VERSION: '~> 8'