Skip to content

Update tests description #670

Update tests description

Update tests description #670

name: Update tests description
on:
schedule:
# Every day at 11pm UTC (6pm in us-central1)
- cron: 0 23 * * *
workflow_dispatch:
jobs:
update-tests-description:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
# A token is needed to be able to push on main, maybe this can be changed later
# with another GHA or with some webhook?
# This token is linked to a personal account (already used for GCP runner)
# So in case of token issue you have to check (no specific order and for example):
# - the expiration date
# - if the account associated still exists
# - if the person still has access to the repo
token: ${{ secrets.SELF_HOSTED_RUNNER_PAT_TOKEN }}
- name: Generate tests description file
id: readme_generator
run: |
# Generate checksum of current file
FILE="tests/README.md"
OLD_CHK=$(sha512sum ${FILE} 2>/dev/null) || true
# Create new file
pushd tests >/dev/null && make generate-readme && popd >/dev/null
# Generate checksum of new file
NEW_CHK=$(sha512sum ${FILE} 2>/dev/null) || true
# Compare checksum and set generate value if needed
[[ "${NEW_CHK}" != "${OLD_CHK}" ]] && echo "generate=needed" >> ${GITHUB_OUTPUT} || true
- name: Push modified file
if: steps.readme_generator.outputs.generate == 'needed'
env:
CI_COMMIT_AUTHOR: "github-actions"
CI_COMMIT_EMAIL: "[email protected]"
CI_COMMIT_MESSAGE: "ci: update tests/README.md file"
CI_COMMIT_FILE: "tests/README.md"
run: |
git config --global user.name "${{ env.CI_COMMIT_AUTHOR }}"
git config --global user.email "${{ env.CI_COMMIT_EMAIL }}"
git add ${{ env.CI_COMMIT_FILE }}
git commit -m "${{ env.CI_COMMIT_MESSAGE }}"
git push