chore(docs): add info about mobile #284
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: Compare Build Logs | |
on: | |
pull_request: | |
types: [opened, synchronize, reopened, edited] | |
jobs: | |
compare-build-logs: | |
runs-on: ubuntu-latest | |
permissions: | |
checks: write | |
pull-requests: write | |
contents: write | |
issues: read | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Fetch all history for accurate comparisons | |
- name: Checkout dev branch | |
run: git checkout dev | |
- name: Install dependencies (dev branch) | |
run: npm install | |
- name: Build project (dev branch) and save log | |
run: npm run build > dev-build-log.txt 2>&1 | |
- name: Extract relevant section from dev log | |
run: | | |
sed -n '/building for production.../,/modules transformed./p' dev-build-log.txt > relevant-dev-log.txt | |
- name: Save extracted dev log as artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: relevant-dev-log | |
path: relevant-dev-log.txt | |
- name: Checkout PR branch | |
run: git checkout ${{ github.head_ref }} | |
- name: Install dependencies (PR branch) | |
run: npm install | |
- name: Build project (PR branch) and save log | |
run: npm run build > pr-build-log.txt 2>&1 | |
- name: Extract relevant section from PR log | |
run: | | |
sed -n '/building for production.../,/modules transformed./p' pr-build-log.txt > relevant-pr-log.txt | |
- name: Save extracted PR log as artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: relevant-pr-log | |
path: relevant-pr-log.txt | |
- name: Compare extracted sections for differences | |
id: diff_check | |
run: | | |
echo "Comparing relevant sections for differences..." | |
diff relevant-dev-log.txt relevant-pr-log.txt > log-diff.txt || true | |
if [ -s log-diff.txt ]; then | |
echo "Differences detected." | |
echo "diff_found=true" >> $GITHUB_ENV | |
else | |
echo "No differences found." > log-diff.txt | |
echo "diff_found=false" >> $GITHUB_ENV | |
fi | |
- name: Upload diff as artifact for review | |
uses: actions/upload-artifact@v4 | |
with: | |
name: build-log-diff | |
path: log-diff.txt | |
- name: Read log-diff.txt content | |
id: read_diff | |
run: | | |
if [ -f log-diff.txt ]; then | |
echo "DIFF_CONTENT<<EOF" >> $GITHUB_ENV | |
cat log-diff.txt >> $GITHUB_ENV | |
echo "EOF" >> $GITHUB_ENV | |
else | |
echo "No diff file found." >> $GITHUB_ENV | |
fi | |
- name: Comment PR with build log differences | |
if: env.diff_found == 'true' | |
uses: actions-ecosystem/action-create-comment@v1 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
body: | | |
**Build Log Differences Found**: | |
```diff | |
${{ env.DIFF_CONTENT }} | |
``` |