Skip to content

Commit 3933744

Browse files
Mudaafiesezen
andauthored
[NO-CSL] Add GitHub Actions (#1)
* lint * feat: Adds GitHub Actions * Add diffend --------- Co-authored-by: Enes Kutay SEZEN <eneskutaysezen@gmail.com>
1 parent 0051652 commit 3933744

File tree

10 files changed

+182
-20
lines changed

10 files changed

+182
-20
lines changed

.diffend.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
project_id: '4095d386-8e3c-4755-acde-77cd76153a66'
2+
shareable_id: '89899076-a5bc-42f0-ba72-b0d98172da08'
3+
shareable_key: 'f5885572-4055-46b7-ba99-cd350d3675ba'

.github/dependabot.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
version: 2
2+
3+
updates:
4+
# Maintain dependencies for npm packages
5+
- package-ecosystem: "npm"
6+
directory: "/"
7+
schedule:
8+
interval: "daily"
9+
# Disable version updates for npm dependencies
10+
# This option has no impact on security updates, which have a separate, internal limit of ten open pull requests.
11+
open-pull-requests-limit: 0
12+
reviewers:
13+
- "mudaafi" # Ahmad
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: 'CodeQL'
13+
14+
on:
15+
push:
16+
branches: [main]
17+
pull_request:
18+
# The branches below must be a subset of the branches above
19+
branches: [main]
20+
schedule:
21+
- cron: '34 5 * * 4'
22+
23+
jobs:
24+
analyze:
25+
name: Analyze
26+
runs-on: ubuntu-latest
27+
permissions:
28+
actions: read
29+
contents: read
30+
security-events: write
31+
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
language: ['javascript']
36+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
37+
# Learn more about CodeQL language support at https://git.io/codeql-language-support
38+
39+
steps:
40+
- name: Checkout repository
41+
uses: actions/checkout@v2
42+
43+
# Initializes the CodeQL tools for scanning.
44+
- name: Initialize CodeQL
45+
uses: github/codeql-action/init@v1
46+
with:
47+
languages: ${{ matrix.language }}
48+
# If you wish to specify custom queries, you can do so here or in a config file.
49+
# By default, queries listed here will override any specified in a config file.
50+
# Prefix the list here with "+" to use these queries and those in the config file.
51+
# queries: ./path/to/local/query, your-org/your-repo/queries@main
52+
53+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
54+
# If this step fails, then you should remove it and run the build manually (see below)
55+
- name: Autobuild
56+
uses: github/codeql-action/autobuild@v1
57+
58+
# ℹ️ Command-line programs to run using the OS shell.
59+
# 📚 https://git.io/JvXDl
60+
61+
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
62+
# and modify them (or add more) to build your code if your project
63+
# uses a compiled language
64+
65+
#- run: |
66+
# make bootstrap
67+
# make release
68+
69+
- name: Perform CodeQL Analysis
70+
uses: github/codeql-action/analyze@v1

.github/workflows/run-diffend.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Run Diffend
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- '**'
7+
concurrency:
8+
group: run-diffend-${{ github.head_ref }}
9+
cancel-in-progress: true
10+
jobs:
11+
diffend:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Check out code
15+
uses: actions/checkout@v3
16+
- name: Set up node
17+
uses: actions/setup-node@v2
18+
with:
19+
node-version: '18.13.0'
20+
- name: Install Diffend (Mend)
21+
run: npm install -g https://my.diffend.io/releases/npm/stable.tgz
22+
- name: Install dependencies with Diffend
23+
run: diffend npm install
24+
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Run license check
2+
on:
3+
pull_request:
4+
branches:
5+
- "**"
6+
concurrency:
7+
group: run-license-${{ github.head_ref }}
8+
cancel-in-progress: true
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
node: ["18.13.0"]
15+
steps:
16+
- name: Check out code
17+
uses: actions/checkout@v2
18+
- name: Set up node
19+
uses: actions/setup-node@v2
20+
with:
21+
node-version: ${{ matrix.node }}
22+
- name: Install dependencies
23+
run: npm install
24+
- name: Run license check
25+
run: npm run check-license

.github/workflows/run-lint.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Run lint
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- '**'
7+
concurrency:
8+
group: run-lint-${{ github.head_ref }}
9+
cancel-in-progress: true
10+
jobs:
11+
lint:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Check out code
15+
uses: actions/checkout@v3
16+
- name: Set up node
17+
uses: actions/setup-node@v2
18+
with:
19+
node-version: '18.13.0'
20+
- name: Install dependencies
21+
run: npm install
22+
- name: Run lint
23+
run: npm run lint

.github/workflows/spell-check.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Spell check
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- '**'
7+
concurrency:
8+
group: spell-check-${{ github.head_ref }}
9+
cancel-in-progress: true
10+
jobs:
11+
check:
12+
name: Run spell check
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Check out code
16+
uses: actions/checkout@v3
17+
- name: Set up node
18+
uses: actions/setup-node@v2
19+
with:
20+
node-version: '18.13.0'
21+
- name: Spell check
22+
run: npx cspell "**/*.{ts,tsx}"

src/hooks/useProductCardProps.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
import { useCallback } from 'react';
2-
import useCioClient from './useCioClient';
32

43
export type CioClientConfig = { apiKey?: string };
54

6-
const useCioProductCardProps = ({ customCallbackOne, customCallbackTwo }, apiKey: string) => {
7-
const cioClient = useCioClient(apiKey);
8-
5+
const useCioProductCardProps = ({ customCallbackOne, customCallbackTwo }) => {
96
const callbackOne = useCallback(() => {
107
customCallbackOne();
118
// Run the default callback for tracking here

src/stories/components/ProductCard.stories.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ type Story = StoryObj<typeof meta>;
2626
// More on writing stories with args: https://storybook.js.org/docs/react/writing-stories/args
2727
export const Primary: Story = {
2828
args: {
29-
primary: true,
3029
label: 'Button',
3130
},
3231
};

src/stories/components/ProductCardExample.tsx

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,42 +10,28 @@ import './button.css';
1010
* Attribute-types determine the type of control: boolean = toggle, string = text input, enum = select
1111
*/
1212
interface ProductCardExampleProps {
13-
/**
14-
* Is this the principal call to action on the page?
15-
*/
16-
primary?: boolean;
1713
/**
1814
* What background color to use
1915
*/
2016
backgroundColor?: string;
21-
/**
22-
* How large should the button be?
23-
*/
24-
size?: 'small' | 'medium' | 'large' | 'extra';
2517
/**
2618
* Button contents
2719
*/
2820
label: string;
29-
/**
30-
* Optional click handler
31-
*/
32-
onClick?: () => void;
3321
}
3422

3523
// Note Description here will be parsed into the story description
3624
/**
3725
* A Product Card UI Component
3826
*/
3927
export default function ProductCardExample({
40-
primary = false,
41-
size = 'medium',
4228
backgroundColor,
4329
label,
4430
...props
4531
}: ProductCardExampleProps) {
4632
return (
4733
<PlpContextProvider apiKey={DEMO_API_KEY}>
48-
<ProductCard />
34+
<ProductCard {...props} />
4935
</PlpContextProvider>
5036
);
5137
}

0 commit comments

Comments
 (0)