Feat : SDK - getContract #9
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: Validate PR | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
jobs: | |
validate: | |
name: validate | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- uses: pnpm/action-setup@v2 | |
with: | |
version: 8.6.0 | |
- name: Use Node.js 16.x | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 16.x | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile | |
- name: Save PR number | |
run: echo ${{ github.event.number }} > pr.txt | |
- name: Get changed files | |
id: changed-files | |
uses: tj-actions/changed-files@v35 | |
with: | |
dir_names: true | |
files: | | |
data/** | |
- name: List all changed tokens | |
id: changed_tokens | |
run: | | |
tokens="" | |
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do | |
token=$(echo -e "$file" | sed -nr "s|^data/([^/]*/?).*|\1|p") | |
tokens+="${token}," | |
done | |
echo "result=${tokens%,*}" >> $GITHUB_OUTPUT | |
- name: Validate token list | |
if: ${{ steps.changed_tokens.outputs.result != '' }} | |
run: | | |
pnpm validate --datadir ./data --tokens "${{ steps.changed_tokens.outputs.result }}" 2> err.txt 1> std.txt | |
- name: Print output | |
if: ${{ always() && steps.changed_tokens.outputs.result != '' }} | |
run: | | |
cat std.txt; cat err.txt | |
- name: Upload artifacts | |
if: ${{ always() && steps.changed_tokens.outputs.result != '' }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: logs-artifact | |
path: | | |
pr.txt | |
err.txt | |
std.txt | |
- name: Upload validation results | |
if: ${{ always() && steps.changed_tokens.outputs.result != '' }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: validation-artifacts | |
path: validation_results.txt |