.github/workflows/report.yml #260
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: Report | |
on: | |
push: | |
branches: [main] | |
schedule: | |
- cron: "0 */2 * * *" | |
workflow_dispatch: | |
jobs: | |
endpoint-report: | |
name: Quality Report | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
chain: | |
- crab | |
- darwinia | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install dependencies | |
env: | |
MILLER_VERSION: 6.7.0 | |
run: | | |
BIN_PATH=$HOME/.local/bin | |
rm -rf ${BIN_PATH} || true | |
mkdir -p ${BIN_PATH} | |
# miller | |
curl -LO https://github.com/johnkerl/miller/releases/download/v${MILLER_VERSION}/miller-${MILLER_VERSION}-linux-amd64.tar.gz | |
tar -zxf miller-${MILLER_VERSION}-linux-amd64.tar.gz -C ./ | |
mv miller-${MILLER_VERSION}-linux-amd64/mlr $BIN_PATH/ | |
# set execute permission | |
chmod +x ${BIN_PATH}/mlr | |
# clean | |
rm -rf miller-* | |
- name: Check http | |
run: scripts/report-endpoint.sh ${{ matrix.chain }} | |
- name: Remove old report | |
run: | | |
THREE_MONTHS_AGO=$(date --date='3 months ago' +%Y-%m) | |
rm -rf report/${THREE_MONTHS_AGO}* | |
- name: Commit files | |
run: | | |
MSG=$(cat dist/latest.log) | |
git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
git pull origin ${{ github.ref }} | |
git add . | |
git commit -a -m "${MSG:-New report generated}" || true | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: ${{ github.ref }} | |