automatic chores (ea0a8063) π [skip-ci] #558
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Automatic chores | |
on: | |
push: | |
branches: | |
- dev | |
paths: | |
- '.github/workflows/automatic_chores.yml' | |
- '.readme/*.md' | |
- '.readme/blueprint.json' | |
- '.changelog/*.md' | |
- '.changelog/blueprint.json' | |
- 'server/**' | |
- 'client/**' | |
- 'shared/**' | |
- 'package.json' | |
jobs: | |
automatic_chores: | |
name: Automatic chores | |
runs-on: ubuntu-latest | |
if: "!contains(github.event.head_commit.message, '[skip-ci]')" | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
persist-credentials: false | |
fetch-depth: 0 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ vars.NODE_VERSION }} | |
- run: | | |
npm ci --no-audit --no-fund --loglevel=error --include=dev | |
- name: ESLint and prettier | |
run: | | |
npm run lint:fix | |
npm run prettier:write | |
- name: Generating README and CHANGELOG using @appnest/readme | |
run: | | |
npx concurrently \ | |
"npx @appnest/readme generate --config .readme/blueprint.json --silent" \ | |
"npx @appnest/readme generate --config .changelog/blueprint.json --silent" | |
- name: Add all changes | |
run: | | |
git add -A | |
- name: Get git context | |
id: git_context | |
run: | | |
status=`git status --porcelain` | |
echo "::set-output name=status::$status" | |
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)" | |
- name: Commit files as {github-automatic-chores} (if staged changes) | |
if: ${{ steps.git_context.outputs.status != '' }} | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "github-automatic-chores" | |
git commit --no-verify -m "automatic chores (${{ steps.git_context.outputs.sha_short }}) π [skip-ci]" \ | |
-m "This is a commit done by the GitHub action \ | |
https://github.com/Puzzlepart/did/blob/dev/.github/workflows/automatic_chores.yml. \ | |
This way we avoid having to generate documentation, run eslint etc. locally before \ | |
commiting to the repo. See https://github.com/Puzzlepart/did/issues/903 for more details." | |
- name: Push changes (if staged changes) | |
if: ${{ steps.git_context.outputs.status != '' }} | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GH_TOKEN }} | |
branch: ${{ github.ref }} |