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

Added support for chatops using prettier and github actions #37

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
38 changes: 38 additions & 0 deletions .github/workflows/prettier.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
on:
issue_comment:
types: [created]
name: Commands
jobs:
style:
if: startsWith(github.event.comment.body, '/style')
name: style
runs-on: ubuntu-latest
steps:
- name: Install yarn
run: |
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt update
sudo apt install yarn

- uses: actions/checkout@v2
- name: Initialize yarn
run: |
yarn init -y
yarn add -E prettier
- uses: r-lib/actions/pr-fetch@master
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Run yarn
run: yarn run prettier --write '**/*.{css,js,html}'

- name: commit
run: |
git add \*.css \*.html \*.js
git config --global user.email "[email protected]"
git config --global user.name "Bot"
if [[ $(git diff --name-only --cached) != "" ]]; then git commit -m 'automated syle update' ; fi
- uses: r-lib/actions/pr-push@master
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}