Skip to content

Commit

Permalink
chore: bootstrap release-please (#31)
Browse files Browse the repository at this point in the history
* chore: bootstrap releases for path: .

* [MegaLinter] Apply linters fixes

---------

Co-authored-by: jdx <jdx@users.noreply.github.com>
  • Loading branch information
jdx and jdx committed Mar 16, 2024
1 parent be8d6d5 commit b6a7584
Show file tree
Hide file tree
Showing 17 changed files with 151 additions and 114 deletions.
2 changes: 1 addition & 1 deletion .github/renovate.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [ "github>jdx/renovate-config" ]
"extends": ["github>jdx/renovate-config"]
}
4 changes: 2 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ jobs:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
needs: build
runs-on: ubuntu-latest
name: Deploy
Expand Down
113 changes: 61 additions & 52 deletions .github/workflows/mega-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
---
name: MegaLinter

# Trigger mega-linter at every push. Action will also be visible from Pull
# Requests to main
# Trigger mega-linter at every push. Action will also be visible from
# Pull Requests to main
on:
# Comment this line to trigger action only on pull-requests
# (not recommended if you don't pay for GH Actions)
Expand Down Expand Up @@ -42,14 +42,13 @@ jobs:
runs-on: ubuntu-latest

# Give the default GITHUB_TOKEN write permission to commit and push, comment
# issues & post new PR; remove the ones you do not need
# issues, and post new Pull Requests; remove the ones you do not need
permissions:
contents: write
issues: write
pull-requests: write

steps:

# Git Checkout
- name: Checkout Code
uses: actions/checkout@v4
Expand All @@ -64,15 +63,14 @@ jobs:
- name: MegaLinter

# You can override MegaLinter flavor used to have faster performances
# More info at https://megalinter.io/flavors/
# More info at https://megalinter.io/latest/flavors/
uses: oxsecurity/megalinter@v7

id: ml

# All available variables are described in documentation
# https://megalinter.io/configuration/
# https://megalinter.io/latest/config-file/
env:

# Validates all source when push on main, else just the git diff with
# main. Override with true if you always want to lint all sources
#
Expand All @@ -83,22 +81,15 @@ jobs:
# VALIDATE_ALL_CODEBASE: >-
# ${{
# github.event_name == 'push' &&
# contains(fromJSON('["refs/heads/main", "refs/heads/master"]'), github.ref)
# github.ref == 'refs/heads/main'
# }}
VALIDATE_ALL_CODEBASE: >-
${{
github.event_name == 'push' &&
contains(fromJSON('["refs/heads/main", "refs/heads/master"]'), github.ref)
}}
VALIDATE_ALL_CODEBASE: true

GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# ADD YOUR CUSTOM ENV VARIABLES HERE OR DEFINE THEM IN A FILE
# ADD YOUR CUSTOM ENV VARIABLES HERE TO OVERRIDE VALUES OF
# .mega-linter.yml AT THE ROOT OF YOUR REPOSITORY

# Uncomment to disable copy-paste and spell checks
# DISABLE: COPYPASTE,SPELL

# Upload MegaLinter artifacts
- name: Archive production artifacts
uses: actions/upload-artifact@v4
Expand All @@ -109,61 +100,79 @@ jobs:
megalinter-reports
mega-linter.log
# Set APPLY_FIXES_IF var for use in future steps
- name: Set APPLY_FIXES_IF var
run: |
printf 'APPLY_FIXES_IF=%s\n' "${{
steps.ml.outputs.has_updated_sources == 1 &&
(
env.APPLY_FIXES_EVENT == 'all' ||
env.APPLY_FIXES_EVENT == github.event_name
) &&
(
github.event_name == 'push' ||
github.event.pull_request.head.repo.full_name == github.repository
)
}}" >> "${GITHUB_ENV}"
# Set APPLY_FIXES_IF_* vars for use in future steps
- name: Set APPLY_FIXES_IF_* vars
run: |
printf 'APPLY_FIXES_IF_PR=%s\n' "${{
env.APPLY_FIXES_IF == 'true' &&
env.APPLY_FIXES_MODE == 'pull_request'
}}" >> "${GITHUB_ENV}"
printf 'APPLY_FIXES_IF_COMMIT=%s\n' "${{
env.APPLY_FIXES_IF == 'true' &&
env.APPLY_FIXES_MODE == 'commit' &&
(!contains(fromJSON('["refs/heads/main", "refs/heads/master"]'), github.ref))
}}" >> "${GITHUB_ENV}"
# Create pull request if applicable
# (for now works only on PR from same repository, not from forks)
- name: Create Pull Request with applied fixes
uses: peter-evans/create-pull-request@v6
id: cpr
if: env.APPLY_FIXES_IF_PR == 'true'
if: >-
steps.ml.outputs.has_updated_sources == 1 &&
(
env.APPLY_FIXES_EVENT == 'all' ||
env.APPLY_FIXES_EVENT == github.event_name
) &&
env.APPLY_FIXES_MODE == 'pull_request' &&
(
github.event_name == 'push' ||
github.event.pull_request.head.repo.full_name == github.repository
) &&
!contains(github.event.head_commit.message, 'skip fix')
with:
token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }}
commit-message: "[MegaLinter] Apply linters automatic fixes"
title: "[MegaLinter] Apply linters automatic fixes"
labels: bot

- name: Create PR output
if: env.APPLY_FIXES_IF_PR == 'true'
if: >-
steps.ml.outputs.has_updated_sources == 1 &&
(
env.APPLY_FIXES_EVENT == 'all' ||
env.APPLY_FIXES_EVENT == github.event_name
) &&
env.APPLY_FIXES_MODE == 'pull_request' &&
(
github.event_name == 'push' ||
github.event.pull_request.head.repo.full_name == github.repository
) &&
!contains(github.event.head_commit.message, 'skip fix')
run: |
echo "PR Number - ${{ steps.cpr.outputs.pull-request-number }}"
echo "PR URL - ${{ steps.cpr.outputs.pull-request-url }}"
# Push new commit if applicable
# (for now works only on PR from same repository, not from forks)
- name: Prepare commit
if: env.APPLY_FIXES_IF_COMMIT == 'true'
if: >-
steps.ml.outputs.has_updated_sources == 1 &&
(
env.APPLY_FIXES_EVENT == 'all' ||
env.APPLY_FIXES_EVENT == github.event_name
) &&
env.APPLY_FIXES_MODE == 'commit' &&
github.ref != 'refs/heads/main' &&
(
github.event_name == 'push' ||
github.event.pull_request.head.repo.full_name == github.repository
) &&
!contains(github.event.head_commit.message, 'skip fix')
run: sudo chown -Rc $UID .git/

- name: Commit and push applied linter fixes
uses: stefanzweifel/git-auto-commit-action@v4
if: env.APPLY_FIXES_IF_COMMIT == 'true'
uses: stefanzweifel/git-auto-commit-action@v5
if: >-
steps.ml.outputs.has_updated_sources == 1 &&
(
env.APPLY_FIXES_EVENT == 'all' ||
env.APPLY_FIXES_EVENT == github.event_name
) &&
env.APPLY_FIXES_MODE == 'commit' &&
github.ref != 'refs/heads/main' &&
(
github.event_name == 'push' ||
github.event.pull_request.head.repo.full_name == github.repository
) &&
!contains(github.event.head_commit.message, 'skip fix')
with:
branch: >-
${{
Expand All @@ -172,5 +181,5 @@ jobs:
github.ref
}}
commit_message: "[MegaLinter] Apply linters fixes"
commit_user_name: mise-en-dev
commit_user_email: 123107610+mise-en-dev@users.noreply.github.com
commit_user_name: megalinter-bot
commit_user_email: nicolas.vuillamy@ox.security
2 changes: 1 addition & 1 deletion .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ jobs:
steps:
- uses: google-github-actions/release-please-action@v4
with:
command: manifest
token: ${{ secrets.MY_RELEASE_PLEASE_TOKEN }}
release-type: rust
1 change: 0 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ jobs:
token: ${{ secrets.GH_BOT_TOKEN }}
formula: usage
tap: jdx/homebrew-tap

# push-to-registry:
# name: "Push Docker image to Docker Hub"
# if: ${{ github.event.workflow_run.conclusion == 'success' }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: test
on:
push:
branches: ['main']
branches: ["main"]
pull_request:

concurrency:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@
# already existing elements were commented out

#/target

megalinter-reports/
2 changes: 2 additions & 0 deletions .mega-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,5 @@ DISABLE_LINTERS:
# - command: apk add --no-cache zlib-dev zlib-static openssl-dev libffi-dev

SHOW_ELAPSED_TIME: true

FILTER_REGEX_EXCLUDE: ^(examples/docs|\.github/workflows)
6 changes: 6 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
CHANGELOG.md
docs/.vitepress
docs/public/site.webmanifest
examples/docs
lefthook.yml
pnpm-lock.yaml
3 changes: 3 additions & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
".": "0.1.9"
}
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ Usage is a spec and CLI for defining CLI tools. Arguments, flags, environment va
can all be defined in a Usage spec. It can be thought of like [OpenAPI (swagger)](https://www.openapis.org/)
for CLIs. Here are some potential reasons for defining your CLI with a Usage spec:

* Generate autocompletion scripts
* Generate markdown documentation
* Generate man pages
* Use an advanced arg parser in any language
* Scaffold one spec into different CLI frameworks—even different languages
* [coming soon] Host your CLI documentation on usage.sh
- Generate autocompletion scripts
- Generate markdown documentation
- Generate man pages
- Use an advanced arg parser in any language
- Scaffold one spec into different CLI frameworks—even different languages
- [coming soon] Host your CLI documentation on usage.sh

See more at [usage.jdx.dev](https://usage.jdx.dev/).

Expand Down
61 changes: 30 additions & 31 deletions docs/.vitepress/config.mts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { defineConfig } from 'vitepress'
import { defineConfig } from "vitepress";

// https://vitepress.dev/reference/site-config
export default defineConfig({
Expand All @@ -17,58 +17,57 @@ export default defineConfig({
themeConfig: {
// https://vitepress.dev/reference/default-theme-config
nav: [
{text: 'Home', link: '/'},
{text: 'Spec', link: '/spec/'},
{text: 'CLI', link: '/cli/'},
{ text: "Home", link: "/" },
{ text: "Spec", link: "/spec/" },
{ text: "CLI", link: "/cli/" },
],

sidebar: [
{
text: 'CLI',
link: '/cli/',
text: "CLI",
link: "/cli/",
items: [
{text: 'Completions', link: '/cli/completions'},
{text: 'Manpages', link: '/cli/manpages'},
{text: 'Markdown', link: '/cli/markdown'},
{text: 'Scripts', link: '/cli/scripts'},
]
{ text: "Completions", link: "/cli/completions" },
{ text: "Manpages", link: "/cli/manpages" },
{ text: "Markdown", link: "/cli/markdown" },
{ text: "Scripts", link: "/cli/scripts" },
],
},
{
text: 'Spec',
link: '/spec/',
text: "Spec",
link: "/spec/",
items: [
{
text: 'Reference',
link: '/spec/reference/',
text: "Reference",
link: "/spec/reference/",
items: [
{text: 'arg', link: '/spec/reference/arg'},
{text: 'cmd', link: '/spec/reference/cmd'},
{text: 'complete', link: '/spec/reference/complete'},
{text: 'flag', link: '/spec/reference/flag'},
{ text: "arg", link: "/spec/reference/arg" },
{ text: "cmd", link: "/spec/reference/cmd" },
{ text: "complete", link: "/spec/reference/complete" },
{ text: "flag", link: "/spec/reference/flag" },
// { text: 'env', link: '/spec/reference/env' },
{ text: 'config', link: '/spec/reference/config' },
]
{ text: "config", link: "/spec/reference/config" },
],
},
]
}
],
},
],

socialLinks: [
{icon: 'github', link: 'https://github.com/jdx/usage'}
],
socialLinks: [{ icon: "github", link: "https://github.com/jdx/usage" }],
editLink: {
pattern: 'https://github.com/jdx/usage/edit/main/docs/:path',
pattern: "https://github.com/jdx/usage/edit/main/docs/:path",
},
// carbonAds: {
// code: 'CWYIPKQN',
// placement: 'misejdxdev',
// },
search: {
provider: 'local'
provider: "local",
},
footer: {
message: 'Licensed under the MIT License. Maintained by <a href="https://github.com/jdx">@jdx</a> and <a href="https://github.com/jdx/usage/graphs/contributors">friends</a>.',
message:
'Licensed under the MIT License. Maintained by <a href="https://github.com/jdx">@jdx</a> and <a href="https://github.com/jdx/usage/graphs/contributors">friends</a>.',
copyright: 'Copyright © 2024 <a href="https://github.com/jdx">@jdx</a>',
},
}
})
},
});
Loading

0 comments on commit b6a7584

Please sign in to comment.