GitHub Action to automatically fix TypeScript formatting issues #2
Workflow file for this run
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: Check and Fix Formatting | |
on: pull_request | |
env: | |
PYTHON_DIR: 'extensions/positron-python' | |
jobs: | |
format: | |
if: github.event.pull_request.head.repo.full_name == github.repository | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
with: | |
ref: ${{ github.head_ref }} | |
- name: prettier | |
working-directory: ${{ env.PYTHON_DIR }} | |
run: npm install prettier && npm run format-fix | |
- name: Check for modified files | |
id: git-check | |
run: echo "modified=$(if git diff-index --quiet HEAD --; then echo "false"; else echo "true"; fi)" >> $GITHUB_OUTPUT | |
- name: Push changes | |
if: steps.git-check.outputs.modified == 'true' | |
run: | | |
git config --global user.name 'Positron Bot' | |
git config --global user.email 'positron-bot@posit.co' | |
git remote set-url origin https://x-access-token:${{ secrets.POSITRON_GITHUB_PAT }}@github.com/${{ github.repository }} | |
git commit -am "Automated formatting fixes" | |
git push |