Skip to content

Commit

Permalink
Merge branch 'main' into feat-630-date-picker
Browse files Browse the repository at this point in the history
  • Loading branch information
glenflorendo authored Apr 6, 2024
2 parents 397515d + ebc6aa4 commit dcb1e52
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 3 deletions.
8 changes: 8 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
*-lock.*
.pnpm-store
build
coverage
data
dist
node_modules
package.*
63 changes: 63 additions & 0 deletions .github/workflows/compliance.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Compliance

on:
pull_request_target:
types:
- opened
- edited
- synchronize
- reopened
- unassigned

jobs:
check-for-linked-issue:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Check for keyword and issue number
id: check-for-keyword
uses: actions/github-script@v7
with:
script: |
// Retrieve body of context.payload and search for GitHub keywords
const prBody = context.payload.pull_request.body;
const prNumber = context.payload.pull_request.number;
const prOwner = context.payload.pull_request.user.login;
const regex = /(?<!Example:\s*)(close|closes|closed|fix|fixes|fixed|resolve|resolves|resolved)\s+#(\d+)/i;
const match = prBody.match(regex);
let prComment;
if (!match) {
console.log('PR does not have a properly linked issue. Posting comment...');
prComment = `@${prOwner}, this Pull Request is not linked to a valid issue. Please provide a valid linked issue in "Related Issues" above, using the format of "Resolves #" + issue number.`;
}
else {
let [ , keyword, linkNumber ] = match;
console.log('Found a keyword: \'' + keyword + '\'. Checking for legitimate linked issue...');
try {
const response = await github.rest.issues.get({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: linkNumber,
});
console.log('Found an issue: \'#' + linkNumber + '\' in repo. Reference is a legitimate linked issue.');
}
catch (error) {
console.log('Couldn\'t find issue #' + linkNumber + ' in repo. Posting comment...');
prComment = `@${prOwner}, the issue number referenced above as "**${keyword} #${linkNumber}**" is not found. Please replace with a valid issue number.`;
}
}
if (prComment) {
github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
body: prComment,
});
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"main": "index.js",
"scripts": {
"build": "pnpm nx run-many --target=build --output-style=stream --all",
"ci:format": "pnpm dlx prettier --check --ignore-unknown '**/*.{css,js,json,jsx,md,ts,tsx,yaml}'",
"ci:lint": "pnpm dlx eslint --fix-dry-run '**/*.{js,jsx,ts,tsx}'",
"ci:format": "prettier --check --ignore-unknown '**/*.{css,js,json,jsx,md,ts,tsx,yaml}'",
"ci:lint": "eslint --fix-dry-run '**/*.{js,jsx,ts,tsx}'",
"clean": "rm -rf dist node_modules && pnpm --recursive --parallel exec rm -rf dist node_modules",
"dev": "pnpm nx run-many --target=dev --output-style=stream --all",
"graph": "pnpm nx graph",
Expand Down
1 change: 1 addition & 0 deletions packages/ui/src/components/calendar/calendar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ export default function Calendar({ initDate = new Date(), onSelectValueChange }:
return (
<td
key={key}
data-testid={key}
onClick={() => handleSelected(ele as CalendarDate)}
className={clsx(
"h-8 w-8 text-center text-xs font-normal leading-[18.8px]",
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/components/date-input/date-input.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ describe("Date Input", () => {
expect(monthOptions).toHaveTextContent(month);
expect(yearOptions).toHaveTextContent(year);

expect(screen.getByText(day).getAttribute("class")).toContain("rounded-full");
expect(screen.getByTestId(`${today.getMonth()}/${day}/${year}`).getAttribute("class")).toContain("rounded-full");
});

test("date input value updates when date is selected in Calendar", async () => {
Expand Down

0 comments on commit dcb1e52

Please sign in to comment.