Skip to content
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

chore: yamllint config and files lint #18

Merged
merged 2 commits into from
Nov 13, 2023
Merged
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
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ body:
id: terms
attributes:
label: πŸ“œ Code of Conduct
description: By submitting this issue, you agree to follow [`Code of Conduct`](https://github.com/raven-actions/actionlint/blob/main/.github/CODE_OF_CONDUCT.md)
description: By submitting this issue, you agree to follow [`Code of Conduct`](../blob/main/.github/CODE_OF_CONDUCT.md)
options:
- label: I agree to follow this project's Code of Conduct.
required: true
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-issue-config.json
# https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/configuring-issue-templates-for-your-repository#configuring-the-template-chooser
---
blank_issues_enabled: false
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ body:
id: terms
attributes:
label: πŸ“œ Code of Conduct
description: By submitting this issue, you agree to follow [`Code of Conduct`](https://github.com/raven-actions/actionlint/blob/main/.github/CODE_OF_CONDUCT.md)
description: By submitting this issue, you agree to follow [`Code of Conduct`](../blob/main/.github/CODE_OF_CONDUCT.md)
options:
- label: I agree to follow this project's Code of Conduct.
required: true
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/question.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ body:
id: terms
attributes:
label: πŸ“œ Code of Conduct
description: By submitting this issue, you agree to follow [`Code of Conduct`](https://github.com/raven-actions/actionlint/blob/main/.github/CODE_OF_CONDUCT.md)
description: By submitting this issue, you agree to follow [`Code of Conduct`](../blob/main/.github/CODE_OF_CONDUCT.md)
options:
- label: I agree to follow this project's Code of Conduct.
required: true
4 changes: 2 additions & 2 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Fixes: #

<!-- Mark with an `x` all the checkboxes that apply (like `[x]`) -->

- [ ] πŸ“š Examples / docs / tutorials
- [ ] πŸ“š Examples/docs/tutorials
- [ ] πŸ› Bug fix (non-breaking change which fixes an issue)
- [ ] πŸ₯‚ Improvement (non-breaking change which improves an existing feature)
- [ ] πŸš€ New feature (non-breaking change which adds functionality)
Expand All @@ -23,5 +23,5 @@ Fixes: #

<!-- Mark with an `x` all the checkboxes that apply (like `[x]`) -->

- [ ] I've read the [`Code of Conduct`](https://github.com/raven-actions/actionlint/blob/main/.github/CODE_OF_CONDUCT.md)> document.
- [ ] I've read the [`Code of Conduct`](https://github.com/raven-actions/actionlint/blob/main/.github/CODE_OF_CONDUCT.md) document.
- [ ] I've read the [`Contributing`](https://github.com/raven-actions/actionlint/blob/main/.github/CONTRIBUTING.md) guide.
4 changes: 2 additions & 2 deletions .github/SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
## 🎯 Supported Versions

| Version | Supported |
|:-------:|:---------:|
| 1.x.x | βœ… |
| :-----: | :-------: |
| 1.x.x | βœ… |

## 🚨 Reporting a Vulnerability

Expand Down
File renamed without changes.
7 changes: 4 additions & 3 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# yaml-language-server: $schema=https://json.schemastore.org/dependabot-2.0.json
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
---
version: 2
updates:
# https://docs.github.com/en/code-security/dependabot/working-with-dependabot/keeping-your-actions-up-to-date-with-dependabot
Expand All @@ -10,7 +11,7 @@ updates:
schedule:
interval: daily
commit-message:
prefix: "⬆️ github-actions"
prefix: ci
include: scope
labels:
- dependencies
10 changes: 10 additions & 0 deletions .github/linters/.yamllint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# yaml-language-server: $schema=https://json.schemastore.org/yamllint.json
# https://yamllint.readthedocs.io/en/stable/configuration.html#extending-the-default-configuration
---
extends: default

locale: en_US.UTF-8

rules:
line-length: disable
comments: disable
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
name: CI

on:
on: # yamllint disable-line rule:truthy
pull_request:
branches:
- main
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/linter.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
name: Linter

on:
on: # yamllint disable-line rule:truthy
pull_request:
branches:
- main
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-draft.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
name: Draft Release

on:
on: # yamllint disable-line rule:truthy
push:
branches:
- main
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/release-publish.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
---
name: Publish Release

on:
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#release
on: # yamllint disable-line rule:truthy
release:
types:
- published
Expand Down
26 changes: 11 additions & 15 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
---
default_install_hook_types:
- pre-commit
repos:
- repo: local
hooks:
- id: pre-commit-autoupdate
name: Run pre-commit autoupdate
entry: pre-commit autoupdate
language: system
pass_filenames: false
# files: .pre-commit-config.yaml
# - repo: local
# hooks:
# - id: pre-commit-autoupdate
# name: Run pre-commit autoupdate
# entry: pre-commit autoupdate
# language: system
# pass_filenames: false
# files: .pre-commit-config.yaml

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: check-symlinks
- id: trailing-whitespace
Expand Down Expand Up @@ -39,14 +40,9 @@ repos:
exclude: package-lock.json

- repo: https://github.com/gitleaks/gitleaks
rev: v8.16.3
rev: v8.18.0
hooks:
- id: gitleaks
args:
- --config
- ".github/linters/.gitleaks.toml"

# - repo: https://github.com/rhysd/actionlint
# rev: v1.6.24
# hooks:
# - id: actionlint
15 changes: 9 additions & 6 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,12 @@
"git.autofetch": true,
"git.fetchOnPull": true,
"git.pruneOnFetch": true,
"git.branchProtection": [
"main",
"master",
],
"git.branchProtection": ["main", "master"],
// files
"files.trimTrailingWhitespace": true,
"files.insertFinalNewline": true,
"files.associations": {
"CODEOWNERS": "ignore",
"CODEOWNERS": "ignore"
},
// editor
"editor.formatOnSave": true,
Expand All @@ -26,5 +23,11 @@
"markdown.extension.toc.updateOnSave": true,
"markdown.extension.orderedList.marker": "one",
"markdown.extension.print.absoluteImgPath": true,
"markdown.extension.toc.slugifyMode": "github"
"markdown.extension.toc.slugifyMode": "github",
"yaml.format.singleQuote": false,
"linter.linters": {
"yamllint": {
"configFiles": [".github/linters/.yamllint.yml"]
}
}
}
3 changes: 0 additions & 3 deletions .yamllint

This file was deleted.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Action returns some basic information. For more details, follow [πŸ“€ Outputs](#
## πŸ“₯ Inputs

| Name | Required | Type | Default value | Description |
|:---------------:|:--------:|:--------:|:-------------:|:------------------------------------------------------------------------------------------------------------------------------------------------------------|
| :-------------: | :------: | :------: | :-----------: | :---------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `version` | false | `string` | `latest` | SemVer version of `actionlint`, recommended to keep default: latest |
| `matcher` | false | `bool` | `true` | Use matcher for GitHub annotations |
| `files` | false | `string` | *not set* | To lint different workflow files (default searching directory is `.github/workflows`), use comma-separated glob patterns, e.g., `tests/*.yml, tests/*.yaml` |
Expand All @@ -83,7 +83,7 @@ Action returns some basic information. For more details, follow [πŸ“€ Outputs](#
## πŸ“€ Outputs

| Name | Type | Description |
|:----------------:|:--------:|:-------------------------------------------------------------------------------------------------------------------------------|
| :--------------: | :------: | :----------------------------------------------------------------------------------------------------------------------------- |
| `version-semver` | `string` | SemVer version of `actionlint`, recommended to keep default: latest |
| `version-tag` | `string` | Use matcher for GitHub annotations |
| `exit-code` | `int` | Exit status code based on [actionlint exit status](https://github.com/rhysd/actionlint/blob/main/docs/usage.md#exit-status) |
Expand Down
3 changes: 2 additions & 1 deletion tests/fixtures/test.broken.yaml
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
on:
---
on: # yamllint disable-line rule:truthy
push:
branch: test-only/foo-bar

Check failure on line 4 in tests/fixtures/test.broken.yaml

View workflow job for this annotation

GitHub Actions / Dog food (test inputs)

unexpected key "branch" for "push" section. expected one of "branches", "branches-ignore", "paths", "paths-ignore", "tags", "tags-ignore", "types", "workflows"
tags:
- 'v\d+'

Check failure on line 6 in tests/fixtures/test.broken.yaml

View workflow job for this annotation

GitHub Actions / Dog food (test inputs)

character '\' is invalid for branch and tag names. only special characters
jobs:
test:
strategy:
matrix:
os: [macos-latest, linux-latest]

Check failure on line 11 in tests/fixtures/test.broken.yaml

View workflow job for this annotation

GitHub Actions / Dog food (test inputs)

label "linux-latest" is unknown. available labels are "windows-latest", "windows-2022", "windows-2019", "windows-2016", "ubuntu-latest", "ubuntu-22.04", "ubuntu-20.04", "ubuntu-18.04", "macos-latest", "macos-12", "macos-12.0", "macos-11", "macos-11.0", "macos-10.15", "self-hosted", "x64", "arm", "arm64", "linux", "macos", "windows". if it is a custom label for self-hosted runner, set list of labels in actionlint.yaml config file
runs-on: ${{ matrix.os }}
steps:
- run: echo "Checking commit '${{ github.event.head_commit.message }}'"

Check failure on line 14 in tests/fixtures/test.broken.yaml

View workflow job for this annotation

GitHub Actions / Dog food (test inputs)

"github.event.head_commit.message" is potentially untrusted. avoid using it directly in inline scripts. instead, pass it through an environment variable. see https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions for more details
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node_version: 16.x

Check failure on line 18 in tests/fixtures/test.broken.yaml

View workflow job for this annotation

GitHub Actions / Dog food (test inputs)

input "node_version" is not defined in action "actions/setup-node@v3". available inputs are "always-auth", "architecture", "cache", "cache-dependency-path", "check-latest", "node-version", "node-version-file", "registry-url", "scope", "token"
- uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ matrix.platform }}-node-${{ hashFiles('**/package-lock.json') }}

Check failure on line 22 in tests/fixtures/test.broken.yaml

View workflow job for this annotation

GitHub Actions / Dog food (test inputs)

property "platform" is not defined in object type {os: string}
if: ${{ github.repository.permissions.admin == true }}

Check failure on line 23 in tests/fixtures/test.broken.yaml

View workflow job for this annotation

GitHub Actions / Dog food (test inputs)

receiver of object dereference "permissions" must be type of object but got "string"
- run: npm install && npm test
3 changes: 2 additions & 1 deletion tests/fixtures/test.broken.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
on:
---
on: # yamllint disable-line rule:truthy
push:
branch: test-only/foo-bar

Check failure on line 4 in tests/fixtures/test.broken.yml

View workflow job for this annotation

GitHub Actions / Dog food (test inputs)

unexpected key "branch" for "push" section. expected one of "branches", "branches-ignore", "paths", "paths-ignore", "tags", "tags-ignore", "types", "workflows"
tags:
- 'v\d+'

Check failure on line 6 in tests/fixtures/test.broken.yml

View workflow job for this annotation

GitHub Actions / Dog food (test inputs)

character '\' is invalid for branch and tag names. only special characters
jobs:
test:
strategy:
matrix:
os: [macos-latest, linux-latest]

Check failure on line 11 in tests/fixtures/test.broken.yml

View workflow job for this annotation

GitHub Actions / Dog food (test inputs)

label "linux-latest" is unknown. available labels are "windows-latest", "windows-2022", "windows-2019", "windows-2016", "ubuntu-latest", "ubuntu-22.04", "ubuntu-20.04", "ubuntu-18.04", "macos-latest", "macos-12", "macos-12.0", "macos-11", "macos-11.0", "macos-10.15", "self-hosted", "x64", "arm", "arm64", "linux", "macos", "windows". if it is a custom label for self-hosted runner, set list of labels in actionlint.yaml config file
runs-on: ${{ matrix.os }}
steps:
- run: echo "Checking commit '${{ github.event.head_commit.message }}'"
Expand Down
Loading