Skip to content

Update Parity Docs #148

Update Parity Docs

Update Parity Docs #148

name: Update Parity Docs
on:
schedule:
- cron: 0 5 * * MON
workflow_dispatch:
inputs:
targetBranch:
required: false
type: string
default: 'main'
jobs:
update-parity-coverage-docs:
name: Update Parity Docs
runs-on: ubuntu-latest
steps:
- name: Checkout docs
uses: actions/checkout@v4
with:
fetch-depth: 0
path: docs
ref: ${{ github.event.inputs.targetBranch || 'main' }}
- name: Set up system wide dependencies
run: |
sudo apt-get install jq wget
- name: Set up Python 3.11
id: setup-python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Download metrics data from Moto Integration test pipeline (GitHub)
working-directory: docs
run: ./scripts/get_latest_github_metrics.sh ./target main
env:
GITHUB_TOKEN: ${{ secrets.PRO_ACCESS_TOKEN }}
REPOSITORY_NAME: localstack-moto-test-coverage
ARTIFACT_ID: test-metrics
WORKFLOW: moto-integration-tests
PREFIX_ARTIFACT: moto-integration-test
FILTER_SUCCESS: 0
- name: Download metrics data from Terraform Integration test pipeline (GitHub)
working-directory: docs
run: ./scripts/get_latest_github_metrics.sh ./target main
env:
GITHUB_TOKEN: ${{ secrets.PRO_ACCESS_TOKEN }}
REPOSITORY_NAME: localstack-terraform-test
ARTIFACT_ID: test-metrics
WORKFLOW: "Terraform Tests"
FILTER_SUCCESS: 0
- name: Download metrics data from Pro pipeline (GitHub)
working-directory: docs
run: ./scripts/get_latest_github_metrics.sh ./target master
env:
GITHUB_TOKEN: ${{ secrets.PRO_ACCESS_TOKEN }}
REPOSITORY_NAME: localstack-ext
ARTIFACT_ID: parity-metric-ext-raw-*
WORKFLOW: "Build, Test, Push"
PREFIX_ARTIFACT: pro-integration-test
- name: Download coverage (capture-notimplemented) data from Pro pipeline (GitHub)
working-directory: docs
run: ./scripts/get_latest_github_metrics.sh ./target master
env:
GITHUB_TOKEN: ${{ secrets.PRO_ACCESS_TOKEN }}
REPOSITORY_NAME: localstack-ext
ARTIFACT_ID: capture-notimplemented-pro
WORKFLOW: "Build, Test, Push"
RESOURCE_FOLDER: "metrics-implementation-details"
- name: Download metrics data from latest Community test run (CircleCI)
working-directory: docs
run: ./scripts/get_latest_circleci_metrics.sh ./target
- name: Create Parity Coverage Docs
working-directory: docs
run: |
python3 -m scripts.create_data_coverage -i target/metrics-implementation-details -r target/metrics-raw -o target/updated_coverage -s data/coverage/service_display_name.json
# Move the resulting markdown file to the docs repo
cp -r target/updated_coverage/md/* content/en/references/coverage && rm -R target/updated_coverage/md/
mv -f target/updated_coverage/data/*.json data/coverage
- name: Check for changes
id: check-for-changes
working-directory: docs
run: |
# Check if there are changed files and store the result in resources/diff-check.log
# Check against the PR branch if it exists, otherwise against the main
# Store the result in resources/diff-check.log and store the diff count in the GitHub Action output "diff-count"
mkdir -p resources
(git diff --name-only origin/parity-coverage-auto-updates content/en/references/ 2>/dev/null || git diff --name-only origin/${{ github.event.inputs.targetBranch || 'main' }} content/en/references/ 2>/dev/null) | tee resources/diff-check.log
(git diff --name-only origin/parity-coverage-auto-updates data/coverage/ 2>/dev/null || git diff --name-only origin/${{ github.event.inputs.targetBranch || 'main' }} data/coverage/ 2>/dev/null) | tee -a resources/diff-check.log
echo "diff-count=$(cat resources/diff-check.log | wc -l)" >> $GITHUB_OUTPUT
- name: Read PR markdown template
if: ${{ success() && steps.check-for-changes.outputs.diff-count != '0' && steps.check-for-changes.outputs.diff-count != '' }}
id: template
uses: juliangruber/read-file-action@v1
with:
path: docs/.github/bot_templates/PARITY_COVERAGE_DOCS_PR.md
- name: Create PR
uses: peter-evans/create-pull-request@v6
if: ${{ success() && steps.check-for-changes.outputs.diff-count != '0' && steps.check-for-changes.outputs.diff-count != '' }}
with:
path: docs
title: "Update Parity Coverage Docs"
body: "${{ steps.template.outputs.content }}"
branch: "parity-coverage-auto-updates"
author: "LocalStack Bot <[email protected]>"
committer: "LocalStack Bot <[email protected]>"
commit-message: "update generated parity coverage docs"
token: ${{ secrets.PRO_ACCESS_TOKEN }}
reviewers: steffyP