chore(ipfs-hash): add missing ipfs hashes 🤖 (#436) #416
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: Upload IPFS | |
concurrency: | |
group: ${{ github.workflow }} | |
cancel-in-progress: true | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
upload-to-ipfs: | |
name: aip-uploader | |
if: | | |
!contains(github.event.head_commit.message, 'chore(ipfs-hash)') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: setup config | |
run: | | |
git config --global user.email "gitbot@aave.com" | |
git config --global user.name "Ipfs hash bot :robot:" | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
cache: "npm" | |
- name: Install dependencies | |
run: npm ci | |
- name: Parse Markdown | |
run: npm run parse-markdown | |
- name: Upload to Pinata and theGraph IPFS | |
env: | |
PINATA_KEY: ${{ secrets.PINATA_KEY }} | |
PINATA_SECRET: ${{ secrets.PINATA_SECRET }} | |
run: npm run upload:pinata-thegraph | |
- name: Update readme | |
run: npm run ci:generate-readme | |
# emits a failure in case there are changes | |
# based on this condition we create a pr back to main | |
- name: Check changes | |
id: checkChanges | |
continue-on-error: true | |
run: | | |
if [[ -z $(git status -s) ]] | |
then | |
exit 1 | |
else | |
git checkout -b ipfs-hash/${{ github.sha }} | |
git add . | |
git commit -am "chore(ipfs-hash): add missing ipfs hashes :robot:" | |
git push origin ipfs-hash/${{ github.sha }} | |
exit 0 | |
fi | |
- uses: actions/github-script@v6 | |
if: steps.checkChanges.outcome == 'success' | |
with: | |
script: | | |
github.rest.pulls.create({ | |
title: 'chore(ipfs-hash): new ipfs hashes :rocket: :tada:', | |
body: 'This pr contains all newly created ipfs hashes', | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
head: 'ipfs-hash/${{ github.sha }}', | |
base: '${{ github.event.repository.default_branch }}' | |
}) |