Dynamic_Programming #65
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: Format Markdown Files | |
on: | |
pull_request: | |
branches: | |
- '*' | |
jobs: | |
format: | |
if: '! github.event.pull_request.draft' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Setup Julia | |
uses: julia-actions/setup-julia@v1 | |
with: | |
version: 1.9 | |
- name: Install JuliaFormatter.jl | |
run: julia -e 'import Pkg; Pkg.add("JuliaFormatter")' | |
- name: Get Changed Files | |
id: changed_files | |
uses: tj-actions/[email protected] | |
with: | |
files: | | |
**/*.md | |
- name: Format Markdown Files | |
run: | | |
for file in ${{ steps.changed_files.outputs.all_changed_files }}; do | |
julia format_myst.jl "$file" | |
done | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Commit changes | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git add . | |
git diff-index --quiet HEAD || git commit -m "Apply formatting to Markdown files" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: ${{ github.head_ref }} |