Skip to content
Closed
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
29 changes: 20 additions & 9 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,27 @@ jobs:

steps:
- name: Send repository update event
env:
PR_TITLE: ${{ github.event.pull_request.title }}
PR_URL: ${{ github.event.pull_request.html_url }}
REPO: ${{ github.repository }}
COMMIT: ${{ github.sha }}
run: |
curl -X POST -H "Authorization: token ${{ secrets.GH_PAT }}" \
-H "Accept: application/vnd.github.v3+json" \
-H "Content-Type: application/json" \
https://api.github.com/repos/hubspotdev/CODE-Hub/actions/workflows/update-meta-repo.yml/dispatches \
-d '{
"ref": "main",
"inputs": {
"repo": "'"${{ github.repository }}"'",
"commit": "'"${{ github.sha }}"'",
"pr_title": "'"${{ github.event.pull_request.title }}"'",
"pr_url": "'"${{ github.event.pull_request.html_url }}"'"
}
}'
-d "$(jq -n \
--arg repo "$REPO" \
--arg commit "$COMMIT" \
--arg pr_title "$PR_TITLE" \
--arg pr_url "$PR_URL" \
'{
ref: "main",
inputs: {
repo: $repo,
commit: $commit,
pr_title: $pr_title,
pr_url: $pr_url
}
}')"
48 changes: 48 additions & 0 deletions .github/workflows/run-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Run Tests

on:
pull_request:
branches: [main]

jobs:
run-tests:
name: Run Tests
runs-on: ubuntu-latest
services:
postgres:
image: postgres:14
env:
POSTGRES_DB: testdb
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
ports:
- 5432:5432
options: >-
--health-cmd="pg_isready"
--health-interval=10s
--health-timeout=5s
--health-retries=5
env:
DATABASE_URL: postgres://postgres:password@localhost:5432/testdb

steps:
- uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 18

- name: Install dependencies
run: npm install

- name: Wait for DB to be ready
run: |
echo "Waiting for PostgreSQL to be ready..."
for i in {1..10}; do
pg_isready -h localhost -p 5432 && break
sleep 2
done

- name: Run tests
run: npm test
29 changes: 20 additions & 9 deletions .github/workflows/trigger-submodule-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,27 @@ jobs:

steps:
- name: Send repository update event
env:
PR_TITLE: ${{ github.event.pull_request.title }}
PR_URL: ${{ github.event.pull_request.html_url }}
REPO: ${{ github.repository }}
COMMIT: ${{ github.sha }}
run: |
curl -X POST -H "Authorization: token ${{ secrets.GH_PAT }}" \
-H "Accept: application/vnd.github.v3+json" \
-H "Content-Type: application/json" \
https://api.github.com/repos/hubspotdev/CODE-Hub/dispatches \
-d '{
"event_type": "update-meta-repo",
"client_payload": {
"repo": "'"${{ github.repository }}"'",
"commit": "'"${{ github.sha }}"'",
"pr_title": "'"${{ github.event.pull_request.title }}"'",
"pr_url": "'"${{ github.event.pull_request.html_url }}"'"
}
}'
-d "$(jq -n \
--arg repo "$REPO" \
--arg commit "$COMMIT" \
--arg pr_title "$PR_TITLE" \
--arg pr_url "$PR_URL" \
'{
event_type: "update-meta-repo",
client_payload: {
repo: $repo,
commit: $commit,
pr_title: $pr_title,
pr_url: $pr_url
}
}')"
Loading