Skip to content

Commit

Permalink
Feat limit api requests core contracts check and graphql only on push…
Browse files Browse the repository at this point in the history
… to development branch (#887)

* chore: limit GraphQL analysis to push to development branch

* chore: limit core contracts check API calls

Narrow down test matrix scope to changed core contracts
  • Loading branch information
gitcoindev authored Jan 24, 2024
1 parent 5a8cbb3 commit 47717c1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ name: CodeQL Analysis
on:
pull_request:
push:
branches:
- development

jobs:
code-ql-analysis:
Expand Down
18 changes: 16 additions & 2 deletions .github/workflows/core-contracts-storage-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,24 @@ jobs:
with:
version: nightly

- id: set-matrix
- name: Narrow down test matrix scope to changed contracts to limit API requests
id: changed-contracts
uses: tj-actions/changed-files@v42
with:
files_yaml: |
contracts:
- packages/contracts/src/dollar/core/*.sol
- name: Set contracts matrix
id: set-matrix
working-directory: packages/contracts
if: steps.changed-contracts.outputs.contracts_any_changed == 'true'
env:
CHANGED_CONTRACTS: ${{ steps.changed-contracts.outputs.contracts_all_changed_files }}
run: |
forge tree | grep -E '^src/dollar/core' | cut -d' ' -f1 | xargs basename -s | cut -d'.' -f1 | xargs -I{} echo src/dollar/core/{}.sol:{} >> contracts.txt
for CONTRACT in "$CHANGED_CONTRACTS"; do
echo ${CONTRACT} | xargs basename -a | cut -d'.' -f1 | xargs -I{} echo src/dollar/core/{}.sol:{} >> contracts.txt
done
echo "matrix=$(cat contracts.txt | jq -R -s -c 'split("\n")[:-1]')" >> $GITHUB_OUTPUT
outputs:
Expand Down

0 comments on commit 47717c1

Please sign in to comment.