Skip to content
This repository has been archived by the owner on Mar 3, 2024. It is now read-only.

Add task timing

Add task timing #55

Workflow file for this run

name: Prettier Action
# This action works with pull requests and pushes
# https://github.com/marketplace/actions/prettier-action
on:
pull_request:
branches:
- master
- main
push:
branches:
- master
- main
jobs:
prettier:
# https://github.com/ad-m/github-push-action/issues/96
# Allow write permission for github-actions
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
# Make sure the actual branch is checked out when running on pull requests
ref: ${{ github.head_ref }}
# https://stackoverflow.com/questions/72375995/how-to-get-commit-count-of-the-repository-in-github-actions
# 0 indicates all history for all branches and tags.
fetch-depth: 0
- name: Get commit count
id: commit-count
run: |
echo "COMMIT_COUNT=$(git rev-list --count HEAD)" >> $GITHUB_ENV
echo "Commit count: ${{ env.COMMIT_COUNT }}"
- name: Prettify code
# Step only run if the repo is not created by "using this template" (commit count is 1)
if: ${{ env.COMMIT_COUNT != '1' }}
uses: creyD/[email protected]
with:
# This part is also where you can pass other options, for example:
prettier_options: --write -c **/*.{js,ts,md}