Reduce recreating variables and reading json files #33
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 formatting | |
on: | |
push: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
check_and_fix: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@master | |
with: | |
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo | |
submodules: recursive | |
- name: Extract branch name | |
shell: bash | |
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT | |
id: extract_branch | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.8' | |
- name: Install dependency | |
run: pip install ruff mypy isort pytest | |
- name: Update emoji.json | |
run: curl -o src/sticker_convert/resources/emoji.json -L https://raw.githubusercontent.com/github/gemoji/master/db/emoji.json | |
- name: Ruff check | |
run: ruff check | |
- name: Install test | |
run: | | |
pip install . | |
pip install -r requirements-type.txt | |
- name: mypy | |
run: mypy | |
- name: Ruff format | |
run: ruff format | |
- name: isort | |
run: isort . | |
- name: Commit & Push changes | |
uses: actions-js/push@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
message: Formatting | |
branch: ${{ steps.extract_branch.outputs.branch }} |