diff --git a/.github/workflows/pr-open.yml b/.github/disabled/pr-open.yml similarity index 100% rename from .github/workflows/pr-open.yml rename to .github/disabled/pr-open.yml diff --git a/.github/workflows/main-pr-from-develop-only.yml b/.github/workflows/main-pr-from-develop-only.yml new file mode 100644 index 00000000..66ba2820 --- /dev/null +++ b/.github/workflows/main-pr-from-develop-only.yml @@ -0,0 +1,18 @@ +name: Main Branch Protection + +on: + pull_request: + branches: + - main + +jobs: + check-branch: + runs-on: ubuntu-latest + steps: + - name: Check branch + run: | + if [[ ${GITHUB_HEAD_REF} != develop ]] && ! [[ ${GITHUB_HEAD_REF} =~ ^hotfix/ ]]; + then + echo "Error: Pull request must come from 'develop' or 'hotfix/' branch" + exit 1 + fi \ No newline at end of file diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml new file mode 100644 index 00000000..20f2c82f --- /dev/null +++ b/.github/workflows/playwright.yml @@ -0,0 +1,30 @@ +name: Playwright Tests +on: + deployment_status: +env: + VERCEL_AUTOMATION_BYPASS_SECRET: ${{ secrets.VERCEL_AUTOMATION_BYPASS_SECRET }} + PLAYWRIGHT_TEST_BASE_URL: ${{ github.event.deployment_status.target_url }} +jobs: + test: + timeout-minutes: 60 + runs-on: ubuntu-latest + if: github.event.deployment_status.state == 'success' + steps: + - name: Url of the deployment + run: echo $PLAYWRIGHT_TEST_BASE_URL + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: lts/* + - name: Install dependencies + run: npm install -g yarn && yarn + - name: Install Playwright + run: npx playwright install --with-deps + - name: Run Playwright tests + run: npx playwright test + - uses: actions/upload-artifact@v4 + if: always() + with: + name: playwright-report + path: playwright-report/ + retention-days: 30 diff --git a/.gitignore b/.gitignore index 9693812c..347e5abe 100644 --- a/.gitignore +++ b/.gitignore @@ -30,6 +30,11 @@ npm-debug.log* yarn-debug.log* yarn-error.log* +#Playwright Tests +/test-results/ +/playwright-report/ +/blob-report/ +/playwright/.cache/ + .tina/__generated__ sendgrid.env - diff --git a/README.md b/README.md index ce72aa8e..a666143d 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,6 @@ +Testing the vercel nameing and PRs +---------------------------------- + Useful Links ============ - [Beta site (develop branch)](https://beta.merseysidelatinfestival.co.uk/) @@ -24,21 +27,20 @@ Both to think and discuss Adam ---- -- [ ] Scanned no signed in - [ ] Checked in at, by, using -- [ ] Build a interface for cash sales - [ ] Disclaimer on food choices - [ ] Default prose styles e.g.
{{ markdown }}
- [ ] Return page from checkout - [ ] Allow change name / email for attendee. - [ ] Clear cache on purchase --- +- [x] Build a interface for cash sales +- [x] Scanned no signed in - [x] Merseyside small logo -- [ ] Optimise images +- [x] Optimise images - [x] Video of dancing for hero - [x] Add see through option for a section - [x] Add title to features section - - [X] Hydration error in production - [x] Reverse artist video animation - [x] Student isn't coming through diff --git a/app/[...filename]/page.tsx b/app/[...filename]/page.tsx index 547cee0e..1ed251a4 100644 --- a/app/[...filename]/page.tsx +++ b/app/[...filename]/page.tsx @@ -9,8 +9,11 @@ export default async function Page({ }: { params: { filename: string[] }; }) { - - // console.log("PAGE:",params); + const clerkregex = /^clerk_(.*)$/; + if(clerkregex.test(params.filename[0])) { + redirect(`/admin`); + } + console.log("PAGE:",params,clerkregex.test(params.filename[0])); try { const data = await client.queries.page({ relativePath: `${params.filename}.mdx`, diff --git a/app/api/ticket/update/route.ts b/app/api/ticket/update/route.ts index 8473138c..c04a75c0 100644 --- a/app/api/ticket/update/route.ts +++ b/app/api/ticket/update/route.ts @@ -19,12 +19,12 @@ export async function POST(req: NextRequest) { const user = await currentUser() // && user && user.publicMetadata.role === 'admin' ? 'admin' : 'attendee' if(!user){ return Response.json({error: "User is not signed in."}, { status: 401 }); } if(!user.publicMetadata.admin){ return Response.json({error: "User is does not have change details permissions."}, { status: 401 });} - requester = 'admin' + requester = `admin#${user.id}#${user.firstName}-${user.lastName}` } else { requester = 'attendee' } - const apiRequest = `${process.env.LAMBDA_PREFERENCES}?requested=info&email=${orig_email}&ticketnumber=${orig_ticket_number}` + const apiRequest = `${process.env.LAMBDA_PREFERENCES}?requested=info&email=${orig_email.replace("+","%2B")}&ticketnumber=${orig_ticket_number}` const currentAttendeeResponse = await fetch(apiRequest,{ method: 'GET', @@ -54,7 +54,8 @@ export async function POST(req: NextRequest) { email: orig_email, name_to: name, email_to: email, - phone_to: phone + phone_to: phone, + source: requester } if(process.env.NEXT_PUBLIC_INTERNAL_DEBUG) { console.log("newTicketInfo",newTicketInfo) } @@ -77,3 +78,8 @@ export async function POST(req: NextRequest) { return NextResponse.json({error: error},{status: 500}) } } + +export async function GET(_req: NextRequest) { + const user = await currentUser() // && user && user.publicMetadata.role === 'admin' ? 'admin' : 'attendee' + return NextResponse.json({user: user},{status:200}) +} \ No newline at end of file diff --git a/app/checkout/checkout-client.tsx b/app/checkout/checkout-client.tsx index 4414c686..6b5b4c97 100644 --- a/app/checkout/checkout-client.tsx +++ b/app/checkout/checkout-client.tsx @@ -95,7 +95,7 @@ export default function CheckoutClient() { return (
{ field.type && field.type == 'hidden' ? null - :