Skip to content

Add new GitHub actions #100

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

Merged
merged 3 commits into from
May 2, 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
35 changes: 35 additions & 0 deletions .github/workflows/npm-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: npm-build

on:
pull_request:
branches:
- main
types: [closed]

jobs:
npm-build:
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
ref: 2.x

- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: "16.x"

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Build assets
run: yarn run production

- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
branch: main
commit_message: >
chore: build assets
3 changes: 3 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,8 @@ jobs:
- name: Install Composer dependencies
run: composer install --prefer-dist --no-interaction

- name: Run Laravel Pint
run: composer pint

- name: Execute tests
run: composer pest
1 change: 0 additions & 1 deletion app/Models/Discussion.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ public function getCountAllRepliesWithChildAttribute(): int

foreach ($this->replies()->withCount('allChildReplies')->get() as $reply) {
/** @var Reply $reply */
// @phpstan-ignore-next-line
$count += $reply->all_child_replies_count;
}

Expand Down
2 changes: 1 addition & 1 deletion app/View/Composers/TopContributorsComposer.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public function compose(View $view): void
$topContributors = Cache::remember('contributors', now()->addWeek(), function () {
return User::topContributors()
->get()
->filter(fn (User $contributor) => $contributor->loadCount('discussions')->discussions_count >= 1) // @phpstan-ignore-line
->filter(fn (User $contributor) => $contributor->loadCount('discussions')->discussions_count >= 1)
->take(5);
});

Expand Down