Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update GitHub workflows #7983

Merged
merged 6 commits into from
Nov 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@
## Screenshots

## Notes to reviewer

<hr>

Have you updated the changelog? If this is not necessary, put square brackets around this: skip changelog
51 changes: 51 additions & 0 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Changelog

on:
pull_request:
types:
- opened
- synchronize
- reopened
- edited

jobs:
check:
runs-on: ubuntu-latest

env:
GH_TOKEN: ${{ github.token }}

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Check for [skip changelog]
id: skip
run: |
PR_DESCRIPTION=$(gh pr view https://github.com/${{ github.repository }}/pull/${{ github.event.pull_request.number }} --json body -q '.body')
if echo "$PR_DESCRIPTION" | grep -q "\[skip changelog\]"; then
echo "skip_changelog=true" >> $GITHUB_OUTPUT
else
echo "skip_changelog=false" >> $GITHUB_OUTPUT
fi

- name: Check for changes in doc/CHANGES.md
id: changes
run: |
git fetch origin ${{ github.event.pull_request.base.ref }}
FILES_CHANGED=$(git diff --name-only origin/${{ github.event.pull_request.base.ref }} ${{ github.sha }})
if [[ "$FILES_CHANGED" == *"doc/CHANGES.md"* ]]; then
echo "changes_found=true" >> $GITHUB_OUTPUT
else
echo "changes_found=false" >> $GITHUB_OUTPUT
fi

- name: Final Check
run: |
if [[ "${{ steps.skip.outputs.skip_changelog }}" == "true" || "${{ steps.changes.outputs.changes_found }}" == "true" ]]; then
echo "Either [skip changelog] was found or doc/CHANGES.md was modified. Passing the action."
exit 0
else
echo "Neither [skip changelog] was found nor was doc/CHANGES.md modified. Failing the action."
exit 1
fi
40 changes: 35 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ on:
push:
branches: [master, develop]
pull_request:
types:
- opened
- synchronize

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
Expand All @@ -13,9 +16,33 @@ permissions:
contents: read

jobs:
check:
runs-on: ubuntu-latest

outputs:
skip_rspec: ${{ steps.skip.outputs.skip_rspec }}

env:
GH_TOKEN: ${{ github.token }}

steps:
- name: Check for [skip rspec]
id: skip
run: |
PR_DESCRIPTION=$(gh pr view https://github.com/${{ github.repository }}/pull/${{ github.event.pull_request.number }} --json body -q '.body')
if echo "$PR_DESCRIPTION" | grep -q "\[skip rspec\]"; then
echo "Skip RSpec found in PR description. Passing the action."
echo "skip_rspec=true" >> $GITHUB_OUTPUT
else
echo "skip_rspec=false" >> $GITHUB_OUTPUT
fi

rspec:
name: Ruby ${{ matrix.ruby }} / PostgreSQL ${{ matrix.postgres }}
runs-on: ubuntu-20.04
runs-on: ubuntu-latest

needs: check
if: needs.check.outputs.skip_rspec == 'false'

permissions:
checks: write # for coverallsapp/github-action to create new checks
Expand Down Expand Up @@ -47,7 +74,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
Expand Down Expand Up @@ -100,11 +127,14 @@ jobs:
parallel: true

coveralls:
permissions:
checks: write
name: Coveralls
runs-on: ubuntu-latest

needs: rspec
runs-on: ubuntu-20.04

permissions:
checks: write

steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@master
Expand Down
12 changes: 8 additions & 4 deletions .github/workflows/rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
name: RuboCop

on: [pull_request]
on:
pull_request:
types:
- opened
- synchronize

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Install Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.0

- name: Run RuboCop linter
uses: reviewdog/action-rubocop@v1
uses: reviewdog/action-rubocop@v2
with:
github_token: ${{ secrets.github_token }}
rubocop_flags: -DES
Expand Down