ActionsDetails: finer grained action state #15662
Workflow file for this run
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: Run DangerJS | |
on: | |
pull_request: | |
branches: [main] | |
types: [edited, labeled, opened, pushed, reopened, synchronize] | |
jobs: | |
danger-front: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
# Optimize compute resources by verifying changes in SQL models files and front/pages/api/v1/* before running Danger. | |
- name: Check for file changes | |
id: file_changes | |
run: | | |
git fetch --no-tags --prune --depth=1 origin +refs/heads/main:refs/remotes/origin/main | |
echo "Checking for changed files..." | |
CHANGED_FILES=$(git diff --name-only origin/main ${{ github.sha }} -- 'front/lib/models/' 'front/lib/resources/storage/models/' 'connectors/src/lib/models/' 'connectors/src/resources/storage/models/' 'front/pages/api/v1/') | |
if [ -n "$CHANGED_FILES" ]; then | |
echo "Changed files found:" | |
echo "$CHANGED_FILES" | |
echo "run_danger=true" >> $GITHUB_OUTPUT | |
echo "::warning ::Files in 'front/lib/models/', 'connectors/src/lib/models/', or 'front/pages/api/v1/' have been modified." | |
else | |
echo "No changed files found." | |
echo "run_danger=false" >> $GITHUB_OUTPUT | |
fi | |
- name: Set up Node.js | |
if: ${{ steps.file_changes.outputs.run_danger == 'true' }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "20" | |
- name: Install dependencies | |
if: ${{ steps.file_changes.outputs.run_danger == 'true' }} | |
run: cd front && npm install | |
- name: Run Danger for front | |
if: ${{ steps.file_changes.outputs.run_danger == 'true' }} | |
run: cd front && npx danger ci | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |