Skip to content

Calculate Metrics #2218

Calculate Metrics

Calculate Metrics #2218

name: Calculate Metrics
on:
workflow_dispatch:
push:
branches: [main]
paths:
- tldr/
- .github/workflows/calculate-metrics.yml
- scripts/*.sh
- scripts/*.py
- '!scripts/sort-lychee-output.py'
jobs:
calculate-metrics:
runs-on: ubuntu-latest
name: Calculate Metrics
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
token: ${{ secrets.GITHUB_TOKEN }}
submodules: true
- uses: actions/setup-python@8d9ed9ac5c53483de85588cdf95a591a75ab9f55 # v5.5.0
if: github.ref == 'refs/heads/main'
with:
python-version: '3.12'
cache: 'pip'
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: 'lts/*'
cache: 'npm'
- name: Install npm dependencies
run: npm install -g markdownlint-cli tldr-lint
- name: Install pip dependencies
if: github.ref == 'refs/heads/main'
run: pip install -r requirements.txt && rm -f requirements.txt
- name: Run the script and generate artifacts
run: |
./scripts/calculate-metrics.sh 2>&1 | tee metrics-log.md
cat metrics-log.md >> $GITHUB_STEP_SUMMARY
- name: Upload Calculate Metrics artifact
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: metrics
path: |
metrics-log.md
*.txt
check-pages*/
- name: Create metrics.zip
if: github.ref == 'refs/heads/main'
run: zip -r metrics.zip metrics-log.md *.txt check-pages*/
- name: Upload artifacts to GitHub Release
if: github.ref == 'refs/heads/main'
uses: softprops/action-gh-release@c95fe1489396fe8a9eb87c0abf8aa5b2ef267fda # v2.2.1
with:
tag_name: latest
files: |
metrics-log.md
*.txt
metrics.zip
- name: Update Translation Dashboard Status Issue
if: github.repository == 'tldr-pages/tldr-maintenance' && github.ref == 'refs/heads/main'
run: python3 scripts/update-dashboard-issue.py
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Update Language-specific Translation Dashboard Status Issues
if: github.repository == 'tldr-pages/tldr-maintenance' && github.ref == 'refs/heads/main'
run: python3 scripts/update-language-issues.py
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}