Merge pull request #13 from BretFisher/tweaks-demo-prep

Update in prep for demos
This commit is contained in:
Bret Fisher
2022-03-26 12:00:52 -07:00
committed by GitHub
5 changed files with 94 additions and 33 deletions

7
.github/linters/.markdown-lint.yml vendored Normal file
View File

@@ -0,0 +1,7 @@
---
# MD013/line-length - Line length
MD013:
# Number of characters, default is 80
line_length: 9999
# check code blocks?
code_blocks: false

53
.github/linters/.yaml-lint.yml vendored Normal file
View File

@@ -0,0 +1,53 @@
---
###########################################
# These are the rules used for #
# linting all the yaml files in the stack #
# NOTE: #
# You can disable line with: #
# # yamllint disable-line #
###########################################
rules:
braces:
level: warning
min-spaces-inside: 0
max-spaces-inside: 0
min-spaces-inside-empty: 1
max-spaces-inside-empty: 5
brackets:
level: warning
min-spaces-inside: 0
max-spaces-inside: 0
min-spaces-inside-empty: 1
max-spaces-inside-empty: 5
colons:
level: warning
max-spaces-before: 0
max-spaces-after: 1
commas:
level: warning
max-spaces-before: 0
min-spaces-after: 1
max-spaces-after: 1
comments: disable
comments-indentation: disable
document-end: disable
document-start: disable
empty-lines:
level: warning
max: 2
max-start: 0
max-end: 0
hyphens:
level: warning
max-spaces-after: 1
indentation:
level: warning
spaces: consistent
indent-sequences: true
check-multi-line-strings: false
key-duplicates: enable
line-length: disable
new-line-at-end-of-file: disable
new-lines:
type: unix
trailing-spaces: disable

View File

@@ -0,0 +1,24 @@
---
# THIS IS NOT A TEMPLATE.
# This is just for linting the gha-workflows repo itself.
# We call the reusable workflow from its file path.
name: Lint
on:
push:
branches:
- main
pull_request:
jobs:
call-super-linter:
name: Call Super-Linter
uses: ./.github/workflows/super-linter.yaml
permissions:
contents: read # clone the repo to lint
statuses: write #read/write to repo custom statuses

View File

@@ -1,5 +1,5 @@
---
# original template from: https://github.com/bretfisher/super-linter-example/blob/main/.github/workflows/super-linter.yaml
# original template from: https://github.com/bretfisher/super-linter-workflow/blob/main/.github/workflows/super-linter.yaml
###########################
###########################
@@ -13,19 +13,8 @@ name: Lint all the codes
# https://help.github.com/en/articles/workflow-syntax-for-github-actions
#
#############################
# lint on push to release/main branches
# also lint on all pushes to PRs
#############################
on:
# runs when PRs are merged, or pushes directly to these branches
# if you have multiple release branches, add them to push
push:
branches:
- main
# runs on pushed commits to any PR
pull_request:
# allow reuse of this workflow in other repos
workflow_call:
inputs:
devops-only:
@@ -38,33 +27,22 @@ on:
required: false
type: string
permissions:
actions: none
checks: none # add custom pass/fail checks to the PR
contents: read # git permissions to repo pull/push
deployments: none
issues: none # read/write to repo Issues
packages: none # read/write to repo Packages (ghcr, gems, npm)
pull-requests: none # read/write to repo PRs
repository-projects: none
security-events: none # read/write to repo Security tab API
statuses: write # read/write to repo custom statuses and checks
jobs:
super-lint:
# Name the Job
name: Super-Linter
# Set the agent to run on
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
# Full git history is needed to get a proper list of changed files within `super-linter`
# Full git history is needed to get a proper list of changed files within super-linter
fetch-depth: 0
#############################

View File

@@ -8,16 +8,15 @@ The GitHub [Super-Linter](https://github.com/marketplace/actions/super-linter) p
## Features of this custom Super-Linter example
- All the features of [Super-Linter](https://github.com/marketplace/actions/super-linter) in a *Reusable* Workflow
- Bonus: Optionally turn off non-DevOps linters (CSS, JS, HTML, etc.) when you want to ignore code (in my case it's to ignore sample code I stick in DevOps projects)
- Bonus: I added Job steps to correctly determine which branch to diff files with (in the case of having multiple release branches)
- Bonus: Lints only changed files on a PR, but lints all files on merge to main (or any release) branch
- All the features of [Super-Linter](https://github.com/marketplace/actions/super-linter) in a *Reusable* Workflow.
- Bonus: Optionally turn off non-DevOps linters (CSS, JS, HTML, etc.) when you want to ignore code (in my case it's to ignore sample code I stick in DevOps projects).
- Bonus: I added Job steps to correctly determine which branch to diff files with (in the case of having multiple release branches).
- Bonus: Lints only changed files on a PR, but lints all files on merge to main (or any release) branch.
## How to reuse this example as a *Reusable* Workflow
1. Fork this repository for you to customize your linters
2. Add a workflow to all your other repositories that calls your linter workflow using GitHub's "Reusable Workflow"
3. Add something similar to this to those workflows:
1. Fork this repository for you to customize your linters in a single location for your org/projects.
2. Add a new workflow to all your other repositories and paste in this YAML to call the central-repos reusable workflow.
```yaml
---