Skip to content

Commit

Permalink
Merge branch 'main' into NDT-247-Test-banner-says-Connected-instead-o…
Browse files Browse the repository at this point in the history
…f-Connecting
  • Loading branch information
rafasdc authored May 8, 2024
2 parents 726843a + 4e0f0eb commit 4ea7fbb
Show file tree
Hide file tree
Showing 8 changed files with 249 additions and 33 deletions.
4 changes: 3 additions & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ PR title should follow the `<type>[(optional scope)]: <description>` format.
See docs/Team_Agreements.md#commit-message-guidelines
-->

Implements # \<issue number\>
Implements [NDT-]

<!--
Add detailed description of the changes if the PR title isn't enough
-->

- [ ] Check to trigger automatic release process
24 changes: 24 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,30 @@ jobs:
head: 'chore/release',
base: 'main',
});
is-tagged-release:
runs-on: ubuntu-latest
outputs:
tagVersion: ${{steps.tagVersion.outputs.tagVersion}}
steps:
- name: Git Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Is Tagged Commit
id: tagVersion
# Check if one of the commits is associated with a tag
run: |
echo "tagVersion=$( git tag --merged ${{ github.sha }} --no-merged ${{ github.event.before }} | grep v*)" >>$GITHUB_OUTPUT
ensure-sqitch-plan-ends-with-tag:
runs-on: ubuntu-latest
needs: [is-tagged-release]
if: contains(needs.is-tagged-release.outputs.tagVersion, 'v')
steps:
- uses: actions/checkout@v4
- run: ./.bin/sqitch-last-change-is-tag.sh db

deploy:
if: github.event.ref == 'refs/heads/main'
needs: [test-code, test-containers]
Expand Down
127 changes: 127 additions & 0 deletions .github/workflows/release-process.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
name: Run release process

on:
pull_request:
types: [edited, synchronize]
workflow_call:
secrets:
RENOVATE_GITHUB_TOKEN: { required: true }
RENOVATE_PRIVATE_KEY: { required: true }

jobs:
checkbox_action:
runs-on: ubuntu-latest
steps:
- name: Check release process checkbox
id: checkbox
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const pr = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.payload.pull_request.number
});
const checkboxText = "[x] Check to trigger automatic release process";
const checkboxChecked = pr.data.body.includes(checkboxText);
console.log(checkboxChecked);
return checkboxChecked;
- name: Check if PR is up-to-date with main
id: up_to_date
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const baseRef = context.payload.pull_request.base.ref;
const headRef = context.payload.pull_request.head.ref;
const mainCommits = await github.rest.repos.listCommits({
owner: context.repo.owner,
repo: context.repo.repo,
per_page: 25,
sha: baseRef
}).then(response => response.data.map(commit => commit.sha));
const prCommits = await github.rest.repos.listCommits({
owner: context.repo.owner,
repo: context.repo.repo,
per_page: 300,
sha: headRef
}).then(response => response.data.map(commit => commit.sha));
const containsAllCommits = mainCommits.every(commitSHA =>
prCommits.includes(commitSHA)
);
console.log(`PR contains all commits from main branch: ${containsAllCommits}`);
console.log(`Main Commits: ${mainCommits}`);
console.log(`PR Commits: ${prCommits}`);
console.log(`Result: ${containsAllCommits}`);
return containsAllCommits;
- name: Check PR Approval
id: pr_approval
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const { data: reviews } = await github.rest.pulls.listReviews({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.payload.pull_request.number
});
const approved = reviews.some(review => review.state === 'APPROVED');
console.log(`PR has been ${approved ? 'approved' : 'not approved'}`);
return approved;
- name: Checkout
if: steps.checkbox.outputs.result == 'true' && steps.up_to_date.outputs.result == 'true' && steps.pr_approval.outputs.result == 'true' && !github.event.pull_request.draft
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.RENOVATE_GITHUB_TOKEN }}
- name: Set up Git and import GPG key
if: steps.checkbox.outputs.result == 'true' && steps.up_to_date.outputs.result == 'true' && steps.pr_approval.outputs.result == 'true' && !github.event.pull_request.draft
env:
GPG_PRIVATE_KEY: ${{ secrets.RENOVATE_PRIVATE_KEY }}
run: |
echo "${GPG_PRIVATE_KEY}" | gpg --import
git config user.name "CCBC Service Account"
git config user.email "[email protected]"
git config user.signingkey "$(gpg --list-secret-keys --with-colons | awk -F: '/sec:/ {print $5}')"
git config commit.gpgsign true
- name: dev env setup
if: steps.checkbox.outputs.result == 'true' && steps.up_to_date.outputs.result == 'true' && steps.pr_approval.outputs.result == 'true' && !github.event.pull_request.draft
uses: ./.github/actions/dev-env-setup
- name: Setup Sqitch User
if: steps.checkbox.outputs.result == 'true' && steps.up_to_date.outputs.result == 'true' && steps.pr_approval.outputs.result == 'true' && !github.event.pull_request.draft
run: |
sqitch config --user user.name 'CCBC Service Account'
sqitch config --user user.email '[email protected]'
- name: Make Release
if: steps.checkbox.outputs.result == 'true' && steps.up_to_date.outputs.result == 'true' && steps.pr_approval.outputs.result == 'true' && !github.event.pull_request.draft
run: |
yarn
git checkout "${GITHUB_HEAD_REF}"
yarn run release-it --ci --branch="${GITHUB_HEAD_REF}" --git.commitArgs=-n
- name: Uncheck the checkbox
if: steps.checkbox.outputs.result == 'true' && steps.up_to_date.outputs.result == 'true' && steps.pr_approval.outputs.result == 'true' && !github.event.pull_request.draft
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const checkboxText = "[x] Check to trigger automatic release process";
const prNumber = context.payload.pull_request.number;
const currentPR = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: prNumber
});
const updatedBody = currentPR.data.body.replace(checkboxText, "[ ] Check to trigger automatic release process");
await github.rest.pulls.update({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: prNumber,
body: updatedBody
});
6 changes: 6 additions & 0 deletions app/data/externalConstants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,9 @@ export const CCBC_ASSESSMENT_RFI_INSTRUCTIONS =

export const CCBC_ELIGIBILITY_SCREENING_TEMPLATE =
'https://bcgov.sharepoint.com/:x:/r/teams/00978-ConnectingCommunitiesProgram/Shared%20Documents/CCBC%20Program/0%20FINAL%20PROGRAM%20DOCUMENTATION/3-Eligibility%20Screen/CCBC_Eligibility%20Screening%20Template.xlsm';

export const CCBC_TECH_ESSENTIALS_TEMPLATE =
'https://bcgov.sharepoint.com/:x:/r/teams/053702/Shared%20Documents/General/CCBC%20Program%20Documents/0%20FINAL%20PROGRAM%20DOCUMENTATION/4-Assessments/CCBC%20Assessment%20-%20Tech%20Essentials%20Template.xlsm';

export const CCBC_PM_ESSENTIALS_TEMPLATE =
'https://bcgov.sharepoint.com/:x:/r/teams/053702/Shared%20Documents/General/CCBC%20Program%20Documents/0%20FINAL%20PROGRAM%20DOCUMENTATION/4-Assessments/CCBC%20Assessment%20-%20Project%20Management%20Essentials%20Template.xlsm';
6 changes: 3 additions & 3 deletions app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"@types/jsonlint": "^1.6.0",
"@types/styled-components": "^5.1.26",
"@types/validator": "^13.11.1",
"ajv": "^8.12.0",
"ajv": "^8.13.0",
"archiver": "^5.3.1",
"body-parser": "^1.20.0",
"cheerio": "^1.0.0-rc.12",
Expand Down Expand Up @@ -161,8 +161,8 @@
"prettier": "^3.2.5",
"react-dom": "^18.2.0",
"relay-compiler": "^13.2.0",
"relay-test-utils": "^13.2.0",
"supertest": "^6.3.4",
"relay-test-utils": "^16.2.0",
"supertest": "^7.0.0",
"ts-jest": "^28.0.2",
"ts-node": "^10.9.1",
"typescript": "5.4.5",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,26 @@ import {
AssessmentsForm,
} from 'components/Analyst/Assessments';
import projectManagement from 'formSchema/analyst/projectManagement';
import GuideLink from 'components/Analyst/GuideLink';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faFileLines } from '@fortawesome/free-solid-svg-icons';
import { projectManagementAssessmentQuery } from '__generated__/projectManagementAssessmentQuery.graphql';
import styled from 'styled-components';
import Link from 'next/link';
import { CCBC_PM_ESSENTIALS_TEMPLATE } from 'data/externalConstants';

const StyledInfoBarDiv = styled.div`
display: flex;
gap: ${(props) => props.theme.spacing.medium};
`;

const StyledLink = styled(Link)`
color: ${(props) => props.theme.color.links};
text-decoration: none;
&:hover {
text-decoration: underline;
}
`;

const getPmAssessmentQuery = graphql`
query projectManagementAssessmentQuery($rowId: Int!) {
Expand Down Expand Up @@ -39,6 +58,13 @@ const PmAssessment = ({
<Layout session={session} title="Connecting Communities BC">
<AnalystLayout query={query}>
<AssessmentsTabs />
<StyledInfoBarDiv>
<GuideLink />
<StyledLink href={CCBC_PM_ESSENTIALS_TEMPLATE}>
<FontAwesomeIcon icon={faFileLines} /> CCBC_PM Essentials
Template.xlsm
</StyledLink>
</StyledInfoBarDiv>
<AssessmentsForm
addedContext={{ ccbcNumber: applicationByRowId.ccbcNumber }}
formData={applicationByRowId.assessmentForm?.jsonData}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,24 @@ import {
import technical from 'formSchema/analyst/technical';
import { technicalAssessmentQuery } from '__generated__/technicalAssessmentQuery.graphql';
import GuideLink from 'components/Analyst/GuideLink';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faFileLines } from '@fortawesome/free-solid-svg-icons';
import styled from 'styled-components';
import Link from 'next/link';
import { CCBC_TECH_ESSENTIALS_TEMPLATE } from 'data/externalConstants';

const StyledInfoBarDiv = styled.div`
display: flex;
gap: ${(props) => props.theme.spacing.medium};
`;

const StyledLink = styled(Link)`
color: ${(props) => props.theme.color.links};
text-decoration: none;
&:hover {
text-decoration: underline;
}
`;

const getTechnicalAssessmentQuery = graphql`
query technicalAssessmentQuery($rowId: Int!) {
Expand Down Expand Up @@ -40,7 +58,13 @@ const TechnicalAssessment = ({
<Layout session={session} title="Connecting Communities BC">
<AnalystLayout query={query}>
<AssessmentsTabs />
<GuideLink />
<StyledInfoBarDiv>
<GuideLink />
<StyledLink href={CCBC_TECH_ESSENTIALS_TEMPLATE}>
<FontAwesomeIcon icon={faFileLines} /> CCBC_Tech Essentials
Template.xlsm
</StyledLink>
</StyledInfoBarDiv>
<AssessmentsForm
addedContext={{ ccbcNumber: applicationByRowId.ccbcNumber }}
formData={applicationByRowId.assessmentForm?.jsonData}
Expand Down
Loading

0 comments on commit 4ea7fbb

Please sign in to comment.