Skip to content

17: Updated and cleaned up code #18

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 17 additions & 7 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,17 +1,27 @@
# Drupal editor configuration normalization
# @see http://editorconfig.org/
# This file is copied from config/symfony/.editorconfig in https://github.com/itk-dev/devops_itkdev-docker.
# Feel free to edit the file, but consider making a pull request if you find a general issue with the file.

# This is the top-most .editorconfig file; do not search in parent directories.
# EditorConfig is awesome: https://editorconfig.org

# top-most EditorConfig file
root = true

# All files.
[*]
charset = utf-8
end_of_line = LF
indent_size = 4
indent_style = space
indent_size = 2
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
trim_trailing_whitespace = true

[*.{js,css,scss}]
indent_size = 2

[*.{yml,yaml}]
indent_size = 2

[config/**/*.{yml,yaml}]
indent_size = 4

[*.go]
indent_style = tab
29 changes: 29 additions & 0 deletions .github/workflows/changelog.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Do not edit this file! Make a pull request on changing
# github/workflows/changelog.yaml in
# https://github.com/itk-dev/devops_itkdev-docker if need be.

### ### Changelog
###
### Checks that changelog has been updated

name: Changelog

on:
pull_request:

jobs:
changelog:
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 2

- name: Git fetch
run: git fetch

- name: Check that changelog has been updated.
run: git diff --exit-code origin/${{ github.base_ref }} -- CHANGELOG.md && exit 1 || exit 0
44 changes: 44 additions & 0 deletions .github/workflows/markdown.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Do not edit this file! Make a pull request on changing
# github/workflows/markdown.yaml in
# https://github.com/itk-dev/devops_itkdev-docker if need be.

### ### Markdown
###
### Lints Markdown files (`**/*.md`) in the project.
###
### [markdownlint-cli configuration
### files](https://github.com/igorshubovych/markdownlint-cli?tab=readme-ov-file#configuration),
### `.markdownlint.jsonc` and `.markdownlintignore`, control what is actually
### linted and how.
###
### #### Assumptions
###
### 1. A docker compose service named `markdownlint` for running `markdownlint`
### (from
### [markdownlint-cli](https://github.com/igorshubovych/markdownlint-cli))
### exists.

name: Markdown

on:
pull_request:
push:
branches:
- main
- develop

jobs:
markdown-lint:
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Create docker network
run: |
docker network create frontend

- run: |
docker compose run --rm markdownlint markdownlint '**/*.md'
43 changes: 9 additions & 34 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,13 @@
name: Review

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
push:
branches:
- main
- develop

jobs:
changelog:
runs-on: ubuntu-latest
name: Changelog should be updated
strategy:
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Git fetch
run: git fetch

- name: Check that changelog has been updated.
run: git diff --exit-code origin/${{ github.base_ref }} -- CHANGELOG.md && exit 1 || exit 0

coding-standards-go-fmt:
name: Go coding standards (fmt)
runs-on: ubuntu-latest
Expand All @@ -32,7 +18,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ">=1.23.0"
go-version: "1.24.5"
cache: true

- name: Coding standards
Expand All @@ -51,7 +37,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ">=1.23.0"
go-version: "1.24.5"
cache: true

- name: go vet
Expand All @@ -68,7 +54,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ">=1.23.0"
go-version: "1.24.5"
cache: true

- name: go mod tidy
Expand All @@ -86,7 +72,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ">=1.23.0"
go-version: "1.24.5"
cache: true

- name: Build
Expand All @@ -100,19 +86,8 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ">=1.23.0"
go-version: "1.24.5"
cache: true

- name: Test
run: go test -v ./...

coding-standards-markdown:
name: Markdown coding standards
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Coding standards
run: |
docker run --rm --volume "$(pwd):/md" peterdavehello/markdownlint markdownlint --ignore LICENSE.md '**/*.md'
41 changes: 41 additions & 0 deletions .github/workflows/yaml.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Do not edit this file! Make a pull request on changing
# github/workflows/yaml.yaml in
# https://github.com/itk-dev/devops_itkdev-docker if need be.

### ### YAML
###
### Validates YAML files.
###
### #### Assumptions
###
### 1. A docker compose service named `prettier` for running
### [Prettier](https://prettier.io/) exists.
###
### #### Symfony YAML
###
### Symfony's YAML config files use 4 spaces for indentation and single quotes.
### Therefore we use a [Prettier configuration
### file](https://prettier.io/docs/configuration), `.prettierrc.yaml`, to make
### Prettier format YAML files in the `config/` folder like Symfony expects.

name: YAML

on:
pull_request:
push:
branches:
- main
- develop

jobs:
yaml-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Create docker network
run: |
docker network create frontend

- run: |
docker compose run --rm prettier '**/*.{yml,yaml}' --check
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
/gh-itkdev.exe

dist/
.task
10 changes: 10 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# https://golangci-lint.run/usage/configuration/#config-file

version: "2"

# https://golangci-lint.run/usage/false-positives/
linters:
exclusions:
rules:
- path: "cmd/changelog.go"
text: "Error return value of `cmd.Usage` is not checked"
9 changes: 9 additions & 0 deletions .markdownlint.jsonc
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// This file is copied from config/markdown/.markdownlint.jsonc in https://github.com/itk-dev/devops_itkdev-docker.
// Feel free to edit the file, but consider making a pull request if you find a general issue with the file.

// markdownlint-cli configuration file (cf. https://github.com/igorshubovych/markdownlint-cli?tab=readme-ov-file#configuration)
{
"default": true,
// https://github.com/DavidAnson/markdownlint/blob/main/doc/md013.md
Expand All @@ -9,5 +13,10 @@
// https://github.com/DavidAnson/markdownlint/blob/main/doc/md024.md
"no-duplicate-heading": {
"siblings_only": true
},
// https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/organizing-information-with-collapsed-sections#creating-a-collapsed-section
// https://github.com/DavidAnson/markdownlint/blob/main/doc/md033.md
"no-inline-html": {
"allowed_elements": ["details", "summary"]
}
}
12 changes: 12 additions & 0 deletions .markdownlintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# This file is copied from config/markdown/.markdownlintignore in https://github.com/itk-dev/devops_itkdev-docker.
# Feel free to edit the file, but consider making a pull request if you find a general issue with the file.

# https://github.com/igorshubovych/markdownlint-cli?tab=readme-ov-file#ignoring-files
vendor/
node_modules/
LICENSE.md
# Drupal
web/*.md
web/core/
web/libraries/
web/*/contrib/
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

* [PR-18](https://github.com/itk-dev/gh-itkdev/pull/18)
Updated and cleaned up code
* [PR-16](https://github.com/itk-dev/gh-itkdev/pull/16)
Added version check to determine release type
* [PR-15](https://github.com/itk-dev/gh-itkdev/pull/15)
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

## Installation

```shell
``` shell
gh extension install itk-dev/gh-itkdev
```

Expand All @@ -14,25 +14,25 @@ gh extension install itk-dev/gh-itkdev

Manage changelog based on [keep a changelog](https://keepachangelog.com/en/1.1.0/):

```shell
``` shell
gh itkdev changelog --help
```

Create changelog:

```shell
``` shell
gh itkdev changelog --create
```

Update changelog for a pull request:

```shell
``` shell
gh itkdev changelog --fucking-changelog
```

Update changelog for a release (`«tag»`):

```shell
``` shell
gh itkdev changelog --release «tag»
```

Expand Down
Loading