Skip to content

Commit

Permalink
Merge pull request #106 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 May 24, 2022
2 parents ac4f4c1 + 6e079f5 commit a77dc27
Show file tree
Hide file tree
Showing 57 changed files with 948 additions and 454 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 @@ -8,18 +8,18 @@
"build": "d2-app-scripts build",
"start": "d2-app-scripts start",
"test": "d2-app-scripts test",
"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": "^6.0.1",
"@dhis2/cli-style": "^7.3.0"
"@dhis2/cli-style": "^10.4.1"
},
"dependencies": {
"@dhis2/app-runtime": "^2.8.0",
Expand Down
6 changes: 3 additions & 3 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { useD2 } from '@dhis2/app-runtime-adapter-d2'
import React from 'react'
import AppContainer from './components/app/AppContainer'
import store from './store'
import './locales'
import AppContainer from './components/app/AppContainer.js'
import store from './store/index.js'
import './locales/index.js'

const App = () => {
const { d2 } = useD2()
Expand Down
2 changes: 1 addition & 1 deletion src/actions/dialogActions.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as actions from '../constants/actionTypes'
import * as actions from '../constants/actionTypes.js'

/**
* openDialog - Action creator helper method for creating dialogs
Expand Down
48 changes: 24 additions & 24 deletions src/actions/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { hashHistory } from 'react-router'
import * as actions from '../constants/actionTypes'
import api from '../utils/api'
import * as navigationAction from './navigationActions'
import * as actions from '../constants/actionTypes.js'
import api from '../utils/api.js'
import * as navigationAction from './navigationActions.js'

/**
* receiveNamespaces - Deliver namespaces returned from request
Expand Down Expand Up @@ -374,15 +374,15 @@ export function emptySnackbar() {
* @return {object} Action thunk
*/
export function fetchAndToggleNamespace(namespace, openNamespace = false) {
return dispatch => {
return (dispatch) => {
dispatch(requestKeys(namespace))
return api
.getKeys(namespace)
.then(keys => {
.then((keys) => {
dispatch(receiveKeys(namespace, keys))
})
.then(() => dispatch(toggleNamespace(namespace, openNamespace)))
.catch(error => {
.catch((error) => {
if (error.httpStatusCode === 404) {
// If not found, we remove the namespace from UI
return dispatch(receiveDeleteNamespace(namespace))
Expand All @@ -392,7 +392,7 @@ export function fetchAndToggleNamespace(namespace, openNamespace = false) {
}
return null
})
.catch(error => {
.catch((error) => {
dispatch(rejectKeys(namespace, error))
})
}
Expand All @@ -408,15 +408,15 @@ export function fetchAndToggleNamespace(namespace, openNamespace = false) {
* @return {object} Action thunk
*/
export function fetchAndDisplayKeyValue(namespace, key) {
return dispatch => {
return (dispatch) => {
dispatch(requestValue(namespace, key))
return api
.getValue(namespace, key)
.then(value => {
.then((value) => {
dispatch(receiveValue(namespace, key, value))
dispatch(selectKey(namespace, key, value.value))
})
.catch(error => dispatch(rejectValue(namespace, key, error)))
.catch((error) => dispatch(rejectValue(namespace, key, error)))
}
}

Expand All @@ -426,14 +426,14 @@ export function fetchAndDisplayKeyValue(namespace, key) {
* @returns action thunk
*/
export function fetchNamespaces() {
return dispatch => {
return (dispatch) => {
dispatch(requestNamespaces())
return api
.getNamespaces()
.then(namespaces => {
.then((namespaces) => {
dispatch(receiveNamespaces(namespaces))
})
.catch(error => dispatch(rejectNamespaces(error)))
.catch((error) => dispatch(rejectNamespaces(error)))
}
}

Expand All @@ -450,7 +450,7 @@ export function fetchNamespaces() {
* @return {string} Action thunk
*/
export function createValue(namespace, key, value) {
return dispatch => {
return (dispatch) => {
dispatch(requestCreateValue(namespace, key, value))
return api
.createValue(namespace, key, value)
Expand All @@ -469,11 +469,11 @@ export function createValue(namespace, key, value) {
* @return {object} Action thunk
*/
export function createAndDisplayValue(namespace, key) {
return dispatch => {
return (dispatch) => {
dispatch(createValue(namespace, key, {}))
.then(() => hashHistory.push(`/edit/${namespace}/${key}`))
.then(() => dispatch(fetchAndToggleNamespace(namespace, true)))
.catch(error =>
.catch((error) =>
dispatch({
type: actions.CREATE_VALUE_REJECTED,
namespace,
Expand All @@ -492,9 +492,9 @@ export function createAndDisplayValue(namespace, key) {
* @return {object} Action thunk
*/
export function fetchKeys(namespace) {
return dispatch => {
return (dispatch) => {
dispatch(requestKeys(namespace))
return api.getKeys(namespace).then(keys => {
return api.getKeys(namespace).then((keys) => {
if (keys.length < 1) {
return Promise.reject({ status: 404 })
}
Expand All @@ -512,7 +512,7 @@ export function fetchKeys(namespace) {
* @return {object} Action thunk
*/
export function updateValue(namespace, key, value) {
return dispatch => {
return (dispatch) => {
dispatch(requestUpdateValue(namespace, key, value))
return api
.updateValue(namespace, key, value)
Expand All @@ -536,15 +536,15 @@ export function deleteKey(namespace, key) {
return api
.deleteValue(namespace, key)
.then(() => dispatch(receiveDeleteKey(namespace, key)))
.then(res => {
.then((res) => {
if (getState().display.key == key) {
dispatch(navigationAction.setIgnoreNextNavigationConfirm())
hashHistory.push('/')
}
return res
})
.then(() => dispatch(fetchKeys(namespace)))
.catch(error => {
.catch((error) => {
if (error.httpStatusCode === 404) {
// If not found, we remove the namespace from UI
dispatch(receiveDeleteNamespace(namespace))
Expand All @@ -556,7 +556,7 @@ export function deleteKey(namespace, key) {
dispatch(toggleNamespace(namespace, true))
}
})
.catch(error => {
.catch((error) => {
dispatch(rejectDeleteKey(namespace, key, error))
})
}
Expand All @@ -574,15 +574,15 @@ export function deleteNamespace(namespace) {
dispatch(requestDeleteNamespace(namespace))
return api
.deleteNamespace(namespace)
.then(success => {
.then((success) => {
dispatch(receiveDeleteNamespace(namespace))
if (getState().display.namespace === namespace) {
dispatch(navigationAction.setIgnoreNextNavigationConfirm())
hashHistory.push('/')
}
return success
})
.catch(err => {
.catch((err) => {
console.log(err)
dispatch(rejectDeleteNamespace(namespace))
})
Expand Down
2 changes: 1 addition & 1 deletion src/actions/jsonEditorActions.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as actions from '../constants/jsonEditorTypes'
import * as actions from '../constants/jsonEditorTypes.js'

/**
* searchJSON - Search action in json editor
Expand Down
2 changes: 1 addition & 1 deletion src/actions/navigationActions.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SET_IGNORE_NEXT_CONFIRM_NAVIGATION } from '../constants/actionTypes'
import { SET_IGNORE_NEXT_CONFIRM_NAVIGATION } from '../constants/actionTypes.js'

export function setIgnoreNextNavigationConfirm() {
return {
Expand Down
2 changes: 1 addition & 1 deletion src/actions/sidebarActions.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as actions from '../constants/actionTypes'
import * as actions from '../constants/actionTypes.js'

/**
* searchSidebarChange - signal search bar in sidebar change
Expand Down
10 changes: 5 additions & 5 deletions src/components/app/AppContainer.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { PropTypes } from '@dhis2/prop-types'
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider'
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider.js'
import React, { Component } from 'react'
import { Provider } from 'react-redux'
import { Router, Route, hashHistory, IndexRoute } from 'react-router'
import Theme from '../../utils/theme'
import EditDisplay from '../display/edit/EditDisplay'
import EmptyDisplay from '../display/empty/EmptyDisplay'
import Layout from './Layout'
import Theme from '../../utils/theme.js'
import EditDisplay from '../display/edit/EditDisplay.js'
import EmptyDisplay from '../display/empty/EmptyDisplay.js'
import Layout from './Layout.js'

class AppContainer extends Component {
shouldComponentUpdate() {
Expand Down
20 changes: 10 additions & 10 deletions src/components/app/Layout.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { PropTypes } from '@dhis2/prop-types'
import React, { Component } from 'react'
import * as dialog from '../../constants/dialogTypes'
import ConfirmDeleteKeyDialog from '../dialog/ConfirmDeleteKeyDialog'
import ConfirmDeleteNamespaceDialog from '../dialog/ConfirmDeleteNamespaceDialog'
import DialogRoute from '../dialog/DialogRoute'
import DialogRouter from '../dialog/DialogRouter'
import ErrorDialog from '../dialog/ErrorDialog'
import NewKeyDialog from '../dialog/NewKeyDialog'
import NewNamespaceDialog from '../dialog/NewNamespaceDialog'
import Sidebar from '../sidebar/Sidebar'
import Snackbar from '../utils/Snackbar'
import * as dialog from '../../constants/dialogTypes.js'
import ConfirmDeleteKeyDialog from '../dialog/ConfirmDeleteKeyDialog.js'
import ConfirmDeleteNamespaceDialog from '../dialog/ConfirmDeleteNamespaceDialog.js'
import DialogRoute from '../dialog/DialogRoute.js'
import DialogRouter from '../dialog/DialogRouter.js'
import ErrorDialog from '../dialog/ErrorDialog.js'
import NewKeyDialog from '../dialog/NewKeyDialog.js'
import NewNamespaceDialog from '../dialog/NewNamespaceDialog.js'
import Sidebar from '../sidebar/Sidebar.js'
import Snackbar from '../utils/Snackbar.js'
import styles from './Layout.module.css'

class Layout extends Component {
Expand Down
8 changes: 4 additions & 4 deletions src/components/dialog/ConfirmDeleteKeyDialog.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { PropTypes } from '@dhis2/prop-types'
import React, { Component } from 'react'
import { connect } from 'react-redux'
import { deleteKey } from '../../actions'
import DialogRoot from './DialogRoot'
import { deleteKey } from '../../actions/index.js'
import DialogRoot from './DialogRoot.js'

export class ConfirmDeleteKeyDialog extends Component {
handleConfirmed = () => {
Expand Down Expand Up @@ -45,13 +45,13 @@ ConfirmDeleteKeyDialog.propTypes = {
namespaceStore: PropTypes.any,
}

const mapStateToProps = state => ({
const mapStateToProps = (state) => ({
namespace: state.dialog.namespace,
keyValue: state.dialog.key,
namespaceStore: state.sidebar.namespaces,
})

const mapDispatchToProps = dispatch => ({
const mapDispatchToProps = (dispatch) => ({
deleteKeyInNamespace(namespace, key) {
dispatch(deleteKey(namespace, key))
},
Expand Down
8 changes: 4 additions & 4 deletions src/components/dialog/ConfirmDeleteNamespaceDialog.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { PropTypes } from '@dhis2/prop-types'
import React, { Component } from 'react'
import { connect } from 'react-redux'
import { deleteNamespace } from '../../actions'
import DialogRoot from './DialogRoot'
import { deleteNamespace } from '../../actions/index.js'
import DialogRoot from './DialogRoot.js'

export class ConfirmDeleteNamespaceDialog extends Component {
handleConfirmed = () => {
Expand Down Expand Up @@ -33,11 +33,11 @@ ConfirmDeleteNamespaceDialog.propTypes = {
deleteNamespace: PropTypes.func,
}

const mapStateToProps = state => ({
const mapStateToProps = (state) => ({
namespace: state.dialog.namespace,
})

const mapDispatchToProps = dispatch => ({
const mapDispatchToProps = (dispatch) => ({
deleteNamespace(namespace) {
dispatch(deleteNamespace(namespace))
},
Expand Down
Loading

0 comments on commit a77dc27

Please sign in to comment.