Skip to content

Commit

Permalink
Merge branch 'master' into LIBSEARCH-801-implement-clear-active-filte…
Browse files Browse the repository at this point in the history
…rs-designs-for-advanced-search
  • Loading branch information
erinesullivan committed Oct 14, 2024
2 parents 6436147 + b7dba4c commit d9ed61d
Show file tree
Hide file tree
Showing 12 changed files with 1,382 additions and 1,253 deletions.
41 changes: 41 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
version: 2
updates:
# For npm dependencies
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "monthly"
time: "06:00"
day: "monday"
timezone: "America/Detroit"
commit-message:
prefix: "Monthly npm updates: "
open-pull-requests-limit: 5
reviewers:
- "erinesullivan"
labels:
- "dependencies"
groups:
group-all-npm-updates:
patterns:
- "*"

# For GitHub Actions updates
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"
time: "06:00"
day: "monday"
timezone: "America/Detroit"
commit-message:
prefix: "Monthly action updates: "
open-pull-requests-limit: 5
reviewers:
- "erinesullivan"
labels:
- "dependencies"
groups:
group-all-github-actions-updates:
patterns:
- "*"
25 changes: 25 additions & 0 deletions .github/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/sh

# Get the list of staged .js files
STAGED_JS_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep '.*\.js$')

# Exit if no .js files are staged
if [ "$STAGED_JS_FILES" = "" ]; then
exit 0
fi

# Run ESLint on the staged .js files
echo "Running ESLint..."
npx eslint $STAGED_JS_FILES

# Capture ESLint exit code
ESLINT_RESULT=$?

# Exit with ESLint's result code
if [ $ESLINT_RESULT -ne 0 ]; then
echo "ESLint failed. Commit aborted."
exit 1
fi

echo "All checks passed. Proceeding with commit."
exit 0
38 changes: 38 additions & 0 deletions .github/workflows/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Update dependabot pull request title

on:
pull_request:
types: [opened]

jobs:
update-title:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: actions/checkout@v4
- name: Check conditions
id: check_conditions
run: |
if [[ "${{ github.event.pull_request.user.login }}" != "dependabot[bot]" ]]; then
echo "Author does not match."
exit 0
fi
labels=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/labels | jq -r '.[].name')
if [[ $labels != *"dependencies"* ]]; then
echo "Label does not match."
exit 0
fi
echo "conditions_met=true" >> $GITHUB_ENV
- name: Update PR title
if: env.conditions_met == 'true'
run: |
NEW_TITLE="$(date +'%B %Y') dependency updates."
curl -X PATCH \
-H "Accept: application/vnd.github+json" \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }} \
-d "{\"title\":\"${NEW_TITLE}\"}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/dockerhub-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:

- name: Build and push
id: docker_build
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
push: true
tags: bertrama/search:${{ steps.tag.outputs.TAG }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dockerhub-unstable.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build container image and push to DockerHub
id: docker_build
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
push: true
tags: 'bertrama/search-unstable:${{ github.sha }},bertrama/search-unstable:latest'
Expand Down
13 changes: 2 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,10 @@
This repository contains the front-end code for [search.lib.umich.edu](https://search.lib.umich.edu/) that generates the UI and connects to the middle and backend.

## Getting Started
### 1. Clone Search
```bash
git clone https://github.com/mlibrary/search.git
```

### 2. Install
```bash
npm install
```
Run the `init.sh` script.

### 3. Run Locally
```bash
npm start
./init.sh
```

## Create React App
Expand Down
11 changes: 11 additions & 0 deletions init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

# Must run from the project root directory
echo "🪝 Copying .github/pre-commit to .git/hooks/"
cp .github/pre-commit .git/hooks/pre-commit

echo "📥 Installing Node modules"
npm install

echo "🚀 Starting the app..."
npm start
Loading

0 comments on commit d9ed61d

Please sign in to comment.