Skip to content

Add format files github action #3

Add format files github action

Add format files github action #3

Workflow file for this run

name: "format"
on:
pull_request:
branches: [ master ]
types: [opened,closed,synchronize]
env:
python-version: "3.9"
jobs:
cla-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{python-version}}

Check failure on line 17 in .github/workflows/format.yml

View workflow run for this annotation

GitHub Actions / format

Invalid workflow file

The workflow is not valid. .github/workflows/format.yml (Line: 17, Col: 15): Unrecognized named-value: 'python-version'. Located at position 1 within expression: python-version .github/workflows/format.yml (Line: 20, Col: 27): Unrecognized named-value: 'python-version'. Located at position 1 within expression: python-version
uses: actions/setup-python@v3
with:
python-version: ${{python-version}}
- name: Install dependencies
run: |
python3 -m pip install autopep8
- name: Grant permissions
run: |
chmod u+x "${GITHUB_WORKSPACE}/.github/scripts/format-cpp"
chmod u+x "${GITHUB_WORKSPACE}/.github/scripts/format-py"
- name: Format Codebase
run: |
cd ${GITHUB_WORKSPACE}
"${GITHUB_WORKSPACE}/.github/scripts/format-cpp ${GITHUB_WORKSPACE}"
"${GITHUB_WORKSPACE}/.github/scripts/format-py ${GITHUB_WORKSPACE}"
- name: Commit
run: |
cd ${GITHUB_WORKSPACE}
HAS_CHANGES=$(git diff --cached --name-only)
if [ ${#HAS_CHANGES} -gt 0 ]; then
git commit -m '[Automated Commit] Format Codebase'
git push origin ${{ github.head_ref || github.ref_name }}
fi