Skip to content

Commit

Permalink
Fix for canonical url and adds PR checklist (#619)
Browse files Browse the repository at this point in the history
Co-authored-by: mreed-maphabit <[email protected]>
  • Loading branch information
mreed101 and mreed-maphabit authored Aug 2, 2024
1 parent 8d4fd37 commit 83fdadb
Show file tree
Hide file tree
Showing 10 changed files with 78 additions and 24 deletions.
61 changes: 52 additions & 9 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,66 @@
## Description
Relates to #[TICKET_NUMBER](https://github.com/department-of-veterans-affairs/va.gov-cms/issues/TICKET_NUMBER). (or closes?)

# Description
What does this PR address?

## Testing done
## Ticket
Relates to #[TICKET_NUMBER](https://github.com/department-of-veterans-affairs/va.gov-cms/issues/TICKET_NUMBER). (or closes?)

## Developer Task

## Screenshots
```[tasklist]
- [ ] PR submitted against the `main` branch of `next-build`.
- [ ] Link to the issue that this PR addresses (if applicable).
- [ ] Define all changes in your PR and note any changes that could potentially be breaking changes.
- [ ] PR includes steps to test your changes and links to these changes in the Tugboat preview (if applicable).
- [ ] Provided before and after screenshots of your changes (if applicable).
- [ ] Alerted the #accelerated-publishing Slack channel to request a PR review.
- [ ] You understand that once approved, you are responsible for merging your changes into `main`. (Note that changes to `main` will move automatically into production.)
```

## Testing Steps
Explain the steps needed for testing

## QA steps
What needs to be checked to prove this works?
What needs to be checked to prove it didn't break any related things?
What variations of circumstances (users, actions, values) need to be checked?

```[tasklist]
- [ ] Automated tests have passed
- [ ] Tugboat environment was generated without errors
```
## Screenshots
Before:
After:


## Is this PR blocked by another PR?
- Add the `DO NOT MERGE` label
- Add links to additional PRs here:


# Reviewer

### Reviewing a PR

This section lists items that need to be checked or updated when making changes to this repository.

## Standard Checks

```[tasklist]
- [ ] Code Quality: Readabilty, Naming Conventions, Consistency, Reusability
- [ ] Test Coverage: 80% coverage
- [ ] Functionality: Change functions as expected with no additional bugs
- [ ] Performance: Code does not introduce performance issues
- [ ] Documentation: Changes are documented in their respective README.md files
- [ ] Security: Packages have been approved in the TRM
```

## Merging an Approved Layout

When merging a layout, you must ensure that the content type has been turned on for `next-build` inside the `CMS`. This CMS flag must be turned on for editors to preview their work using the next build preview server.

Resource types (layouts) that have not been approved by design should NOT be pushed to production. Ensure that [slug.tsx](../src/pages/[[...slug]].tsx) does not include your resource type if it is not approved.

The status of layouts should be kept up to date inside [templates.md](./templates.md). This includes QA progress, development progress, etc. A link should be provided for where testing can occur.

## Merging a Non-Approved Layout

Your new resource type should not be included inside [slug.tsx](../src/pages/[[...slug]].tsx). Items added here will go into production once merged into the `main` branch. It is imperative that we do not push anything live that has not been approved.

Ensure that this layout has been added to the [templates.md](./templates.md) file with the current status of the work.
26 changes: 14 additions & 12 deletions READMEs/templates.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,17 @@ With these three files, we can ensure that a given template has adequate test co

The templates in next-build are functional React components. The types or interfaces for a component will likely come from the `@/types/formatted/` directory. This helps ensure that data formatted by a query matches the shape the front end component expects.

## Available Template List

Developers are required to update this section when adding a new layout.
The following layouts are available in next-build.

- (Event) [http://next-content.staging.va.gov.s3-website-us-gov-west-1.amazonaws.com/outreach-and-events/events/69619/]
- (Event Listings) [http://next-content.staging.va.gov.s3-website-us-gov-west-1.amazonaws.com/outreach-and-events/events/]
- (News Story) [http://next-content.staging.va.gov.s3-website-us-gov-west-1.amazonaws.com/eastern-oklahoma-health-care/stories/access-va-health-care-during-federal-holidays-and-247-365-with-va-health-connect/]
- (Press Release) [http://next-content.staging.va.gov.s3-website-us-gov-west-1.amazonaws.com/southern-nevada-health-care/news-releases/vasnhs-to-host-laughlin-pact-act-veterans-town-hall-june-27/]
- (Press Release Listings) [http://next-content.staging.va.gov.s3-website-us-gov-west-1.amazonaws.com/southern-nevada-health-care/news-releases]
- (Story Listings) [http://next-content.staging.va.gov.s3-website-us-gov-west-1.amazonaws.com/eastern-oklahoma-health-care/stories/]
- (Vets Center) [http://next-content.staging.va.gov.s3-website-us-gov-west-1.amazonaws.com/abilene-vet-center]
## Template List

Developers are required to update this section when adding or updating a layout.

| Layout | Example | Status |
| :--------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------ | :---------- |
| Event | [Link](https://dev.va.gov/outreach-and-events/events/69619/) | QA - Design |
| Event Listing | [Link](https://dev.va.gov/outreach-and-events/events/) | QA - Design |
| News Story | [Link](https://dev.va.gov/eastern-oklahoma-health-care/stories/access-va-health-care-during-federal-holidays-and-247-365-with-va-health-connect/) | QA - AP |
| Press Release | [Link](https://dev.va.gov/southern-nevada-health-care/news-releases/vasnhs-to-host-laughlin-pact-act-veterans-town-hall-june-27/) | QA - AP |
| Press Release Listings | [Link](https://dev.va.gov/southern-nevada-health-care/news-releases) | QA - AP |
| Story Listings | [Link](https://dev.va.gov/outreach-and-events/events/) | QA - AP |
| Vets Center | [Link](https://dev.va.gov/outreach-and-events/events/) | QA - AP |
| Step By Step | N/A | Planning |
3 changes: 2 additions & 1 deletion envs/.env.dev
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ NEXT_IMAGE_DOMAIN=https://content-build-medc0xjkxm4jmpzxl3tfbcs7qcddsivh.ci.cms.
# Prod bucket for vets-website assets
# NEXT_PUBLIC_ASSETS_URL=https://prod-va-gov-assets.s3-us-gov-west-1.amazonaws.com/generated/
NEXT_PUBLIC_ASSETS_URL=/generated/
SITE_URL=https://www.va.gov
SITE_URL=https://dev.va.gov
NEXT_PUBLIC_SITE_URL=https://dev.va.gov

# for Drupal preview
DRUPAL_PREVIEW_SECRET=secret
Expand Down
2 changes: 1 addition & 1 deletion envs/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ DRUPAL_CLIENT_SECRET=Retrieve this from AWS SSM /cms/consumers/next-build/client

# for local sitemap generation
SITE_URL=http://localhost:8001

NEXT_PUBLIC_SITE_URL=http://localhost:8001
# for local redis server
REDIS_URL=redis://127.0.0.1:6379

Expand Down
1 change: 1 addition & 0 deletions envs/.env.gha
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ DRUPAL_PREVIEW_SECRET=secret
DRUPAL_CLIENT_ID=Retrieve this from AWS SSM /cms/consumers/next-build/client_id
DRUPAL_CLIENT_SECRET=Retrieve this from AWS SSM /cms/consumers/next-build/client_secret


# Google Analytics (These are the dev environment credentials)
NEXT_PUBLIC_GOOGLE_TAG_MANAGER_ID=GTM-WFJWBD
NEXT_PUBLIC_GOOGLE_TAG_MANAGER_AUTH=N9BisSDKAwJENFQtQIEvXQ
Expand Down
1 change: 1 addition & 0 deletions envs/.env.prod
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ NEXT_IMAGE_DOMAIN=https://prod.cms.va.gov
# NEXT_PUBLIC_ASSETS_URL=https://prod-va-gov-assets.s3-us-gov-west-1.amazonaws.com/generated/
NEXT_PUBLIC_ASSETS_URL=/generated/
SITE_URL=https://www.va.gov
NEXT_PUBLIC_SITE_URL=https://www.va.gov

# for Drupal preview
DRUPAL_PREVIEW_SECRET=secret
Expand Down
1 change: 1 addition & 0 deletions envs/.env.staging
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ DRUPAL_PREVIEW_SECRET=secret
# store these securely in the build pipeline env
#DRUPAL_CLIENT_ID=Retrieve this from AWS SSM /cms/consumers/next-build/client_id
#DRUPAL_CLIENT_SECRET=Retrieve this from AWS SSM /cms/consumers/next-build/client_secret
NEXT_PUBLIC_SITE_URL=https://staging.va.gov

# Google Analytics
# These print directly to the page so do not need to store in SSM.
Expand Down
1 change: 1 addition & 0 deletions envs/.env.test
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ GOOGLE_TAG_MANAGER_ID=

# for cypress
SITE_URL=http://127.0.0.1:8001
NEXT_PUBLIC_SITE_URL=http://127.0.0.1:8001

# Configure the localhost port for the next.js dev server
PORT=3999
1 change: 1 addition & 0 deletions src/lib/utils/environment.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ describe('generateAbsoluteUrlFromEnv', () => {

test('should handle missing SITE_URL environment variable', () => {
process.env.SITE_URL = ''
process.env.NEXT_PUBLIC_SITE_URL = ''
const relativeUrl = 'path/to/resource'
const result = generateAbsoluteUrlFromEnv(relativeUrl)
expect(result).toBe('/path/to/resource')
Expand Down
5 changes: 4 additions & 1 deletion src/lib/utils/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,7 @@ export const generateAbsoluteUrl = (origin: string, relativeUrl: string) => {
}

export const generateAbsoluteUrlFromEnv = (relativeUrl: string) =>
generateAbsoluteUrl(process.env.SITE_URL || '', relativeUrl)
generateAbsoluteUrl(
process.env.SITE_URL || process.env.NEXT_PUBLIC_SITE_URL || '',
relativeUrl
)

0 comments on commit 83fdadb

Please sign in to comment.