Skip to content

Update CI reliability #919

Update CI reliability

Update CI reliability #919

# Set those repository secrets
# (https://help.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets)
# USER_NAME - GitHub user name
# USER_TOKEN - GitHub access token
# JENKINS_TOKEN - GitHub user Jenkins token
name: Update CI reliability
permissions:
issues: write
contents: write
on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
jobs:
create-report:
name: Create and update the report
runs-on: ubuntu-latest
steps:
- name: Clone reliability
uses: actions/checkout@v4
with:
path: reliability
token: ${{ secrets.GITHUB_TOKEN }}
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Install @node-core/utils
run: npm install -g @node-core/utils
- name: Configure @node-core/utils
run: |
ncu-config --global set jenkins_token ${{ secrets.JENKINS_TOKEN }}
ncu-config --global set token ${{ secrets.USER_TOKEN }}
ncu-config --global set username ${{ secrets.USER_NAME }}
- name: Generate reports
run: |
cd reliability
bash ./generate-report.sh
cat ./progress.md >> $GITHUB_STEP_SUMMARY
cat ./reports/$(date +%Y-%m-%d).md >> $GITHUB_STEP_SUMMARY
- name: Create issue
run: |
title_date=$(date +%Y-%m-%d)
echo "{ \"title\": \"CI Reliability ${title_date}\", \"body\": " >> body.json
cat reliability/progress.md | python -c 'import json,sys; print(json.dumps(sys.stdin.read()))' >> body.json
echo "}" >> body.json
curl --request POST \
--url https://api.github.com/repos/${GITHUB_REPOSITORY}/issues \
--header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
--header 'content-type: application/json' \
--data @body.json