diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c37cbe3..9f5d68d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,18 +31,41 @@ jobs: jekyll/builder:3.8.5 /bin/bash -c "gem install bundler && chmod -R 777 /srv/jekyll && jekyll build && bundle exec just-the-docs rake search:init" css: - name: Stylelint + name: Build, Test, and Format runs-on: ubuntu-latest - steps: - - - uses: actions/checkout@master - - name: Use Node.js 10.x + steps: + - uses: actions/checkout@v2 + # Using this so the this instead of GITHUB_TOKEN so that this workflow can trigger another + with: + token: ${{ secrets.PAT }} + - name: Use Node.js 12.x uses: actions/setup-node@v1 with: - node-version: 10.x + node-version: '12.x' + - name: Extract branch name + shell: bash + run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" + id: extract_branch - - name: npm install, build, and test + - run: npm install + - run: npm test + - run: npm run format + - name: Add changed files run: | - npm install - npm test + echo "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$GITHUB_REPOSITORY.git" + git config --global user.email $GITHUB_ACTOR@users.noreply.github.com + git config --global user.name $GITHUB_ACTOR + echo "branch is ${{ steps.extract_branch.outputs.branch }}" + git checkout ${{ steps.extract_branch.outputs.branch }} + git add . + - name: Are there any updates? + shell: bash + run: echo "##[set-output name=status]$(git status -s)" + id: is_dirty + - name: Commit files + if: steps.is_dirty.outputs.status + run: | + echo ${{ steps.is_dirty.outputs.status }} + git commit -m "🎨 Prettier" + git push --force --set-upstream "https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" ${{ steps.extract_branch.outputs.branch }}