Skip to content
This repository has been archived by the owner on Nov 1, 2023. It is now read-only.

Ci/test (#318)

Ci/test (#318) #798

Workflow file for this run

name: Ipfs uploader
# Uploads all changed md files to ipfs once merged to main
# Comments the pr
on:
pull_request:
push:
branches:
- main
jobs:
ipfs-upload:
runs-on: ubuntu-latest
name: Ipfs uploader
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 18
registry-url: "https://registry.npmjs.org"
cache: "yarn"
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Get all changed *.md file(s)
id: changed-files
uses: tj-actions/changed-files@f569b77fb1d9ad9f1a125757d7e9e07b1f320199
with:
json: true
write_output_files: true
files: |
src/**/*.md
- name: Run step if any *.md file(s) change
if: steps.changed-files.outputs.any_changed == 'true'
run: |
cat .github/outputs/all_changed_files.json
- name: replace main with hash
if: github.event_name != 'pull_request' && steps.changed-files.outputs.any_changed == 'true'
run: |
json_array=($(jq -r '.[]' ".github/outputs/all_changed_files.json"))
for i in "${json_array[@]}"
do
sed -i 's@https://github.com/bgd-labs/aave-proposals/blob/main/@https://github.com/bgd-labs/aave-proposals/blob/${{ github.sha }}/@g' $i
sed -i 's@https://github.com/bgd-labs/aave-proposals/tree/main/@https://github.com/bgd-labs/aave-proposals/blob/${{ github.sha }}/@g' $i
done
- name: Upload
if: steps.changed-files.outputs.any_changed == 'true'
env:
PINATA_KEY: ${{ secrets.PINATA_KEY }}
PINATA_SECRET: ${{ secrets.PINATA_SECRET }}
run: |
json_array=($(jq -r '.[]' ".github/outputs/all_changed_files.json"))
for i in "${json_array[@]}"
do
npx aave-cli ipfs $i -u ${{ github.event_name != 'pull_request'}}
done
- name: Create Pull Request
uses: peter-evans/create-pull-request@712add83f26c1e359c046a6ca3dd677fb7017626
if: github.event_name != 'pull_request' && steps.changed-files.outputs.any_changed == 'true'
with:
committer: Ipfs-bot <[email protected]>
commit-message: "chore(ipfs): automated branch/hash replacement [skip ci]"
title: "chore(ipfs): automated branch/hash replacement"
base: "main"