1
0
Fork 0
mirror of https://github.com/kdeldycke/awesome-falsehood.git synced 2024-11-20 11:35:56 -05:00
falsehood/.github/workflows/autofix.yaml
Kevin Deldycke 3787acf6a3
Fix labels.
2020-10-23 10:23:21 +02:00

116 lines
4.1 KiB
YAML

---
name: Autofix
"on":
push:
# Only targets default branch to avoid amplification effects of
# auto-fixing the exact same stuff in multiple non-rebased branches.
branches:
- 'main'
schedule:
# Run linter every week to catch regressions from external dependencies.
- cron: 17 9 * * 1
jobs:
toc:
name: Generator TOC and auto-commit
runs-on: ubuntu-latest
steps:
- name: Install doctoc
run: |
sudo npm install -g doctoc
- uses: actions/checkout@v2.3.3
- name: Generate full TOC
run: |
# Generates title as part of the TOC to avoid extra non-conform blank
# lines. See:
# https://github.com/thlorenz/doctoc/issues/101
# https://github.com/thlorenz/doctoc/pull/145
doctoc --github --title "## Contents" readme.md
- name: Remove forbidden special TOC entries
# See: https://github.com/sindresorhus/awesome-lint/blob/v0.16.0/rules
# /toc.js#L15-L18
run: >
gawk -i inplace '!/^- \[(Contributing|Footnotes)\]\(#.+\)$/{print}'
./readme.md
- name: Commit and push changes
uses: stefanzweifel/git-auto-commit-action@v4.7.1
with:
commit_author: "Kevin Deldycke <kevin@deldycke.com>"
commit_message: "[lint] Update TOC."
file_pattern: readme.md
json:
name: Format JSON files and create a PR
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.3.3
- name: Install linter
run: |
sudo npm install jsonlint -g
- name: Lint
run: >
find ./ -type f -name '*.json' -print -exec
jsonlint --in-place "{}" \;
- uses: peter-evans/create-pull-request@v3
with:
author: "Kevin Deldycke <kevin@deldycke.com>"
commit-message: "[autofix] Format JSON content"
title: "[autofix] Format JSON content"
body: >
[Auto-generated on run
#${{ github.run_id }}](https://github.com/${{ github.repository
}}/actions/runs/${{ github.run_id }}) as defined by [workflow
action](https://github.com/${{ github.repository
}}/blob/${{ github.base_ref }}/.github/workflows/autofix.yaml).
labels: "CI/CD"
assignees: kdeldycke
branch: format-json
typos:
name: Fix typos and create a PR
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.3.3
- uses: sobolevn/misspell-fixer-action@0.1.0
- uses: peter-evans/create-pull-request@v3
with:
author: "Kevin Deldycke <kevin@deldycke.com>"
commit-message: "[autofix] Typo"
title: "[autofix] Typo"
body: >
[Auto-generated on run
#${{ github.run_id }}](https://github.com/${{ github.repository
}}/actions/runs/${{ github.run_id }}) as defined by [workflow
action](https://github.com/${{ github.repository
}}/blob/${{ github.base_ref }}/.github/workflows/autofix.yaml).
labels: "CI/CD"
assignees: kdeldycke
branch: autofix-typo
images:
name: Optimize images
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.3.3
- uses: calibreapp/image-actions@1.1.0
id: image_actions
with:
githubToken: ${{ secrets.GITHUB_TOKEN }}
compressOnly: true
- uses: peter-evans/create-pull-request@v3
with:
author: "Kevin Deldycke <kevin@deldycke.com>"
commit-message: "[autofix] Optimize images"
title: "[autofix] Optimize images"
body: >
[Auto-generated on run
#${{ github.run_id }}](https://github.com/${{ github.repository
}}/actions/runs/${{ github.run_id }}) as defined by [workflow
action](https://github.com/${{ github.repository
}}/blob/${{ github.base_ref }}/.github/workflows/autofix.yaml).
%0A
${{ steps.image_actions.outputs.markdown }}
labels: "CI/CD"
assignees: kdeldycke
branch: optimize-images