Skip to content

Commit 4a2403b

Browse files
authored
Merge pull request #472 from trycompai/claudio/comp-107-automatic-prs-for-release-and-feature-branches
[dev] [claudfuen] claudio/comp-107-automatic-prs-for-release-and-feature-branches
2 parents e6d505f + cfd9d3a commit 4a2403b

11 files changed

+125
-27
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# This pattern will make 'your-username' the owner of every file in the repository.

.github/dependabot.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: npm
4+
directory: "/"
5+
schedule:
6+
interval: daily
7+
target-branch: "main"
8+
open-pull-requests-limit: 3
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Create Feature Branch -> Dev Pull Request
2+
on:
3+
push:
4+
branches:
5+
- feature/*
6+
- bug/*
7+
- task/*
8+
- story/*
9+
- claudio/*
10+
- mariano/*
11+
- lewis/*
12+
- COMP-*
13+
jobs:
14+
create-pull-request:
15+
runs-on: ubuntu-latest-xl
16+
continue-on-error: true
17+
permissions:
18+
pull-requests: write
19+
contents: write
20+
steps:
21+
- name: Add permissions
22+
run: git config --global --add safe.directory /github/workspace
23+
- name: Check out epository code
24+
uses: actions/checkout@v3
25+
- name: Create pull request
26+
if: ${{ success() }}
27+
uses: repo-sync/pull-request@v2
28+
with:
29+
github_token: ${{ secrets.GITHUB_TOKEN }}
30+
destination_branch: "main"
31+
pr_title: "[dev] [${{ github.actor }}] ${{ github.ref_name }}"
32+
pr_label: "automated-pr"
33+
pr_body: |
34+
This is an automated pull request to merge ${{ github.ref_name }} into dev.
35+
It was created by the [Auto Pull Request] action.
36+
Note: This should only be merged after the following checklist is complete:
37+
- [ ] Tested in local environment
38+
- [ ] Created relevant migrations (if any)
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Create Candidate -> Production Pull Request
2+
on:
3+
push:
4+
branches:
5+
- main
6+
jobs:
7+
create-pull-request:
8+
runs-on: ubuntu-latest-xl
9+
permissions:
10+
pull-requests: write
11+
contents: write
12+
steps:
13+
- name: Add permissions
14+
run: git config --global --add safe.directory /github/workspace
15+
continue-on-error: true
16+
- name: Check out repository code
17+
uses: actions/checkout@v3
18+
continue-on-error: true
19+
- name: Get package version
20+
id: package-version
21+
run: echo "::set-output name=PACKAGE_VERSION::$(cat package.json | jq -r .version)"
22+
# The pull-request action will now only run if the checkout action was successful.
23+
- name: Create pull request
24+
if: ${{ success() }} # This step runs only if all previous steps succeeded
25+
uses: repo-sync/pull-request@v2
26+
continue-on-error: true
27+
with:
28+
destination_branch: "release"
29+
github_token: ${{ secrets.GITHUB_TOKEN }}
30+
pr_label: "prod-deploy,automated-pr"
31+
pr_title: "[${{ github.event.repository.name }}] Production Deploy"
32+
pr_body: |
33+
This is an automated pull request to release the candidate branch into production, which will trigger a deployment.
34+
It was created by the [Production PR] action.
35+
# Optionally, you can add a step here to notify you if the previous steps failed,
36+
# so that you can take appropriate actions.
37+
- name: Notify Failure
38+
if: ${{ failure() }} # This step runs only if any of the previous steps failed
39+
run: echo "A step in the job failed. Please check the GitHub Actions logs for details."
40+
# You could also trigger other types of notifications, such as sending an email, an alert to Slack, etc.

.github/workflows/database-migrations-dev.yml renamed to .github/workflows/database-migrations-main.yml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,24 @@
11
name: Database Migrations Dev
2-
32
on:
43
push:
54
branches:
65
- main
76
workflow_dispatch: # Allows manual triggering
8-
97
env:
108
BUN_VERSION: "1.0.26"
11-
129
jobs:
1310
migrate:
1411
name: Run Database Migrations
15-
runs-on: ubuntu-latest
16-
12+
runs-on: ubuntu-latest-xl
1713
steps:
1814
- name: Checkout repository
1915
uses: actions/checkout@v4
20-
2116
- name: Setup Bun
2217
uses: oven-sh/setup-bun@v1
2318
with:
2419
bun-version: ${{ env.BUN_VERSION }}
25-
2620
- name: Install dependencies
2721
run: bun install
28-
2922
- name: Apply database migrations
3023
env:
3124
DATABASE_URL: ${{ secrets.DATABASE_URL_DEV }}

.github/workflows/database-migrations.yml renamed to .github/workflows/database-migrations-release.yml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,24 @@
11
name: Database Migrations
2-
32
on:
43
push:
54
branches:
65
- release
76
workflow_dispatch: # Allows manual triggering
8-
97
env:
108
BUN_VERSION: "1.0.26"
11-
129
jobs:
1310
migrate:
1411
name: Run Database Migrations
15-
runs-on: ubuntu-latest
16-
12+
runs-on: ubuntu-latest-xl
1713
steps:
1814
- name: Checkout repository
1915
uses: actions/checkout@v4
20-
2116
- name: Setup Bun
2217
uses: oven-sh/setup-bun@v1
2318
with:
2419
bun-version: ${{ env.BUN_VERSION }}
25-
2620
- name: Install dependencies
2721
run: bun install
28-
2922
- name: Apply database migrations
3023
env:
3124
DATABASE_URL: ${{ secrets.DATABASE_URL_PROD }}

.github/workflows/trigger-tasks-deploy-dev.yml renamed to .github/workflows/trigger-tasks-deploy-main.yml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,24 @@
11
name: Deploy to Trigger.dev (dev)
2-
32
on:
43
push:
54
branches:
65
- main
7-
86
jobs:
97
deploy:
10-
runs-on: ubuntu-latest
11-
8+
runs-on: ubuntu-latest-xl
129
steps:
1310
- uses: actions/checkout@v4
14-
1511
- name: Use Node.js 20.x
1612
uses: actions/setup-node@v4
1713
with:
1814
node-version: "20.x"
19-
2015
- name: Setup Bun
2116
uses: oven-sh/setup-bun@v1
22-
2317
- name: Install dependencies
2418
run: bun install
25-
2619
- name: Generate Prisma client
2720
working-directory: ./packages/db
2821
run: bunx prisma generate
29-
3022
- name: 🚀 Deploy Trigger.dev
3123
working-directory: ./apps/app
3224
env:

.github/workflows/trigger-tasks-deploy.yml renamed to .github/workflows/trigger-tasks-deploy-release.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ on:
77

88
jobs:
99
deploy:
10-
runs-on: ubuntu-latest
11-
10+
runs-on: ubuntu-latest-xl
1211
steps:
1312
- uses: actions/checkout@v4
1413

.husky/commit-msg

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
export NVM_DIR="$HOME/.nvm"
5+
. "$NVM_DIR/nvm.sh"
6+
7+
export PATH=$PATH:$HOME/.nvm/versions/node/$(nvm current)/bin
8+
9+
npx --version
10+
11+
npx commitlint --edit $1

.husky/pre-commit

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
export NVM_DIR="$HOME/.nvm"
5+
. "$NVM_DIR/nvm.sh"
6+
7+
export PATH=$PATH:$HOME/.nvm/versions/node/$(nvm current)/bin:$HOME/.bun/bin
8+
9+
10+
echo Node version: $(node -v)
11+
echo Bun version: $(bun -v)
12+
13+
bun run test

0 commit comments

Comments
 (0)