Skip to content

Commit

Permalink
Merge pull request #472 from dhis2/update-commit-checking-workflows
Browse files Browse the repository at this point in the history
ci: replace semantic commit checks with new workflow
  • Loading branch information
HendrikThePendric authored Jun 13, 2022
2 parents 9abf721 + 9ba81ae commit 5966e19
Show file tree
Hide file tree
Showing 9 changed files with 751 additions and 270 deletions.
4 changes: 0 additions & 4 deletions .github/semantic.yml

This file was deleted.

32 changes: 32 additions & 0 deletions .github/workflows/dhis2-verify-commits.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: 'dhis2: verify (commits)'

on:
pull_request:
types: ['opened', 'edited', 'reopened', 'synchronize']

jobs:
lint-pr-title:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: c-hive/gha-yarn-cache@v1
- run: yarn install --frozen-lockfile
- id: commitlint
run: echo ::set-output name=config_path::$(node -e "process.stdout.write(require('@dhis2/cli-style').config.commitlint)")
- uses: JulienKode/[email protected]
with:
configuration-path: ${{ steps.commitlint.outputs.config_path }}

lint-commits:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: c-hive/gha-yarn-cache@v1
- run: yarn install --frozen-lockfile
- id: commitlint
run: echo ::set-output name=config_path::$(node -e "process.stdout.write(require('@dhis2/cli-style').config.commitlint)")
- uses: wagoid/commitlint-github-action@v4
with:
configFile: ${{ steps.commitlint.outputs.config_path }}
2 changes: 1 addition & 1 deletion .huskyrc.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const { config } = require('@dhis2/cli-style')
const husky = require(config.husky)

const tasks = arr => arr.join(' && ')
const tasks = (arr) => arr.join(' && ')

module.exports = {
hooks: {
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@
"cy:start": "BROWSER=none yarn start",
"cy:open": "d2-utils-cypress open --appStart 'yarn cy:start'",
"cy:run": "d2-utils-cypress run --appStart 'yarn cy:start'",
"lint:js": "d2-style js check",
"lint:text": "d2-style text check",
"lint:js": "d2-style check js",
"lint:text": "d2-style check text",
"lint:staged": "yarn lint:js --staged && yarn lint:text --staged",
"lint": "yarn lint:js && yarn lint:text",
"format:js": "d2-style js apply",
"format:text": "d2-style text apply",
"format:js": "d2-style apply js",
"format:text": "d2-style apply text",
"format:staged": "yarn format:js --staged && yarn format:text --staged",
"format": "yarn format:js && yarn format:text"
},
"devDependencies": {
"@dhis2/cli-app-scripts": "^8.0.1",
"@dhis2/cli-style": "^7.0.0"
"@dhis2/cli-style": "^10.4.1"
},
"dependencies": {
"@dhis2/app-runtime": "^3.2.0",
Expand Down
4 changes: 2 additions & 2 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { CssVariables } from '@dhis2/ui'
import React from 'react'
import classes from './App.module.css'
import MenuManagement from './components/MenuManagement'
import i18n from './locales'
import MenuManagement from './components/MenuManagement/index.js'
import i18n from './locales/index.js'

const App = () => (
<>
Expand Down
2 changes: 1 addition & 1 deletion src/App.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import ReactDOM from 'react-dom'
import App from './App'
import App from './App.js'

it('renders without crashing', () => {
const div = document.createElement('div')
Expand Down
2 changes: 1 addition & 1 deletion src/components/MenuManagement/DraggableApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const DND_ITEM_TYPE = 'APP'
const DraggableApp = ({ app, onDrag, onDrop }) => {
const [{ isDragging }, connectDrag] = useDrag({
item: { name: app.name, type: DND_ITEM_TYPE },
collect: monitor => ({ isDragging: monitor.isDragging() }),
collect: (monitor) => ({ isDragging: monitor.isDragging() }),
end: onDrop,
})
const [, connectDrop] = useDrop({
Expand Down
18 changes: 9 additions & 9 deletions src/components/MenuManagement/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import { NoticeBox, CenteredContent, CircularLoader, Card } from '@dhis2/ui'
import React, { useMemo, useState, useCallback } from 'react'
import { DndProvider } from 'react-dnd'
import { HTML5Backend } from 'react-dnd-html5-backend'
import i18n from '../../locales'
import DraggableApp from './DraggableApp'
import i18n from '../../locales/index.js'
import DraggableApp from './DraggableApp.js'
import classes from './MenuManagement.module.css'

const query = {
Expand Down Expand Up @@ -40,7 +40,7 @@ const MenuManagement = ({ apps, initialAppsOrder }) => {
i18n.t('Updated order of apps.'),
{ success: true }
)
const { show: showErrorUpdatingAlert } = useAlert(message => message, {
const { show: showErrorUpdatingAlert } = useAlert((message) => message, {
critical: true,
})
const [mutate] = useDataMutation(mutation, {
Expand All @@ -66,7 +66,7 @@ const MenuManagement = ({ apps, initialAppsOrder }) => {
<Card>
<DndProvider backend={HTML5Backend}>
<div className={classes.apps}>
{appsOrder.map(appName => (
{appsOrder.map((appName) => (
<DraggableApp
key={appName}
onDrag={handleAppDrag}
Expand All @@ -86,21 +86,21 @@ MenuManagement.propTypes = {
}

const joinPath = (...parts) => {
const realParts = parts.filter(part => !!part)
return realParts.map(part => part.replace(/^\/+|\/+$/g, '')).join('/')
const realParts = parts.filter((part) => !!part)
return realParts.map((part) => part.replace(/^\/+|\/+$/g, '')).join('/')
}

const MenuManagementWrapper = () => {
const { baseUrl } = useConfig()
const { loading, error, data } = useDataQuery(query)

const apps = useMemo(() => {
const getPath = path =>
const getPath = (path) =>
path.startsWith('http:') || path.startsWith('https:')
? path
: joinPath(baseUrl, 'api', path)

return data?.apps.modules.map(app => ({
return data?.apps.modules.map((app) => ({
...app,
icon: getPath(app.icon),
defaultAction: getPath(app.defaultAction),
Expand All @@ -126,7 +126,7 @@ const MenuManagementWrapper = () => {
}

const appsByName = {}
apps.forEach(app => (appsByName[app.name] = app))
apps.forEach((app) => (appsByName[app.name] = app))

return (
<MenuManagement
Expand Down
Loading

0 comments on commit 5966e19

Please sign in to comment.