Skip to content

CI(deps): Update actions/upload-artifact action to v7 (grass8) #1794

CI(deps): Update actions/upload-artifact action to v7 (grass8)

CI(deps): Update actions/upload-artifact action to v7 (grass8) #1794

---
name: Additional Checks
# Checks which are not in standardized tools such as custom checks by scripts
# in the source code or small 3rd party checks without large projects behind them.
# Number of disconnected, but simple checks can be combined into one workflow
# (and job) to reduce the number of jobs.
on:
push:
branches:
- grass[0-9]+
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
cancel-in-progress: true
permissions: {}
jobs:
additional-checks:
name: Additional checks
runs-on: ubuntu-24.04
permissions:
contents: read
env:
# renovate: datasource=pypi depName=prek
PREK_VERSION: 0.3.4
# renovate: datasource=python-version depName=python
PYTHON_VERSION: "3.14"
steps:
- name: Checkout repository contents
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 31
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install uv and restore its cache
uses: astral-sh/setup-uv@803947b9bd8e9f986429fa0c5a41c367cd732b41 # v7.2.1
with:
enable-cache: false
- name: "Cache pre-commit/prek"
# Not used for releases, only for running pre-commit
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3 # zizmor: ignore[cache-poisoning]
with:
path: |-
~/.cache/prek
key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
- name: Install prek
run: uv tool install "prek@${PREK_VERSION}"
- name: "Run pre-commit/prek for fixes"
run: |
echo '```console' > "$GITHUB_STEP_SUMMARY"
# Enable color output for pre-commit and remove it for the summary
# Use --hook-stage=manual to enable slower pre-commit hooks that are skipped by default
# Skip hooks already handled in another workflow, to avoid duplicate suggestions
# Skip hooks with no fixes made with these hooks (for now)
prek run --all-files --show-diff-on-failure --color=always --hook-stage=manual \
--skip ruff-check --skip ruff-format \
--skip actionlint \
--skip editorconfig-checker \
--skip flake8 \
--skip yamllint | \
tee >(sed -E 's/\x1B\[([0-9]{1,2}(;[0-9]{1,2})*)?[mGK]//g' >> "$GITHUB_STEP_SUMMARY") >&1
exit_code="${PIPESTATUS[0]}"
echo '```' >> "$GITHUB_STEP_SUMMARY"
exit "$exit_code"
- name: Create and uploads code suggestions to apply for pre-commit
# Will fail fast here if there are changes required
id: diff-pre-commit
# To run after pre-commit step exits with failure
if: ${{ !cancelled() }}
uses: OSGeo/grass/.github/actions/create-upload-suggestions@main
with:
tool-name: pre-commit
# To keep repo's file structure in formatted changes artifact
extra-upload-changes: pyproject.toml
- name: "Run pre-commit/prek"
run: |
echo '```console' > "$GITHUB_STEP_SUMMARY"
# Enable color output for pre-commit and remove it for the summary
# Use --hook-stage=manual to enable slower pre-commit hooks that are skipped by default
prek run --all-files --show-diff-on-failure --color=always --hook-stage=manual | \
tee >(sed -E 's/\x1B\[([0-9]{1,2}(;[0-9]{1,2})*)?[mGK]//g' >> "$GITHUB_STEP_SUMMARY") >&1
exit_code="${PIPESTATUS[0]}"
echo '```' >> "$GITHUB_STEP_SUMMARY"
exit "$exit_code"