Address Checks #189
This file contains hidden or 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: Address Checks | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 0 * * *' # Runs daily at midnight | |
jobs: | |
update-data: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '18.x' | |
- name: Install dependencies | |
run: | | |
if [ -e yarn.lock ]; then | |
yarn install | |
yarn global add ts-node | |
elif [ -e package-lock.json ]; then | |
npm ci | |
npm install -g ts-node | |
else | |
npm install | |
npm install -g ts-node | |
fi | |
npm run build | |
- name: Run checks and update data | |
env: | |
ALCHEMY_API_KEY: ${{ secrets.ALCHEMY_API_KEY }} | |
run: | | |
ts-node scripts/runAddressChecks.ts | |
echo "ALL_CHECKS_PASSED=$(cat all_checks_passed.txt)" >> $GITHUB_ENV | |
- name: Create an issue if checks failed | |
if: env.ALL_CHECKS_PASSED != 'true' | |
run: | | |
curl -H "Authorization: Bearer ${{ secrets.ADDRESS_CHECKS }}" \ | |
-H "Content-Type: application/json" \ | |
-d "$(jq -n --arg title ':robot: Address Checks Failed' --arg body "$(cat issue_body.md)" '{title: $title, body: $body}')" \ | |
https://api.github.com/repos/yearn/yearn-devdocs/issues | |
echo "Issue created" |