my fork of the bluesky client
at main 4.7 kB view raw
1# Credit for fingerprint action https://github.com/expo/expo 2# https://github.com/expo/expo/blob/main/.github/workflows/pr-labeler.yml 3--- 4name: PR Tests 5 6on: 7 push: 8 branches: [main] 9 pull_request: 10 types: [opened, synchronize] 11 12concurrency: 13 group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }} 14 cancel-in-progress: true 15 16permissions: 17 pull-requests: write 18 actions: write 19 contents: read 20 21jobs: 22 webpack-analyzer: 23 runs-on: ubuntu-22.04 24 if: ${{ github.event.pull_request.head.repo.full_name == github.repository && github.event_name == 'pull_request'}} 25 steps: 26 - name: ⬇️ Checkout 27 uses: actions/checkout@v4 28 with: 29 fetch-depth: 0 30 31 - name: 🔧 Setup Node 32 uses: actions/setup-node@v4 33 with: 34 node-version-file: .nvmrc 35 cache: yarn 36 37 - name: Ensure tracking relevant branches and checkout base 38 run: | 39 git checkout ${{ github.head_ref }} 40 git checkout ${{ github.base_ref }} 41 42 - name: Get the base commit 43 id: base-commit 44 run: echo base-commit=$(git log -n 1 ${{ github.base_ref }} --pretty=format:'%H') >> "$GITHUB_OUTPUT" 45 46 - name: Merge PR commit 47 run: | 48 # Have to set a git config for the merge to work 49 git config --global user.email "github-actions[bot]@users.noreply.github.com" 50 git config --global user.name "github-actions[bot]" 51 git merge --no-edit ${{ github.head_ref }} 52 yarn install 53 54 - name: 🔦 Generate stats file for PR 55 run: | 56 yarn generate-webpack-stats-file 57 mv stats.json ../stats-new.json 58 59 - name: ⬇️ Get base stats from cache 60 id: get-base-stats 61 uses: actions/cache@v4 62 with: 63 path: stats-base.json 64 key: stats-base-${{ steps.base-commit.outputs.base-commit }} 65 66 - name: Restore to base commit 67 if: ${{ !steps.get-base-stats.outputs.cache-hit }} 68 run: | 69 git reset HEAD~ 70 git restore . 71 72 - name: 🔦 Generate stats file from base commit 73 if: ${{ !steps.get-base-stats.outputs.cache-hit }} 74 run: | 75 yarn install 76 yarn generate-webpack-stats-file 77 mv stats.json stats-base.json 78 79 - name: % Get diff 80 id: get-diff 81 uses: NejcZdovc/bundle-size-diff@v1 82 with: 83 base_path: 'stats-base.json' 84 pr_path: '../stats-new.json' 85 excluded_assets: '(.+).chunk.js|(.+).js.map|(.+).json|(.+).png' 86 87 - name: 💬 Drop a comment 88 uses: marocchino/sticky-pull-request-comment@v2 89 with: 90 header: bundle-diff 91 message: | 92 | Old size | New size | Diff | 93 |----------|----------|-----------------------| 94 | ${{ steps.get-diff.outputs.base_file_string }} | ${{ steps.get-diff.outputs.pr_file_string }} | ${{ steps.get-diff.outputs.diff_file_string }} (${{ steps.get-diff.outputs.percent }}%) | 95 --- 96 97 fingerprint-native: 98 runs-on: ubuntu-22.04 99 if: ${{ github.event.pull_request.head.repo.full_name == github.repository && github.event_name == 'pull_request'}} 100 steps: 101 - name: ⬇️ Checkout 102 uses: actions/checkout@v4 103 with: 104 fetch-depth: 100 105 106 - name: ⬇️ Fetch commits from base branch 107 run: git fetch origin main:main --depth 100 108 if: github.event_name == 'pull_request' 109 110 - name: 🔧 Setup Node 111 uses: actions/setup-node@v4 112 with: 113 node-version-file: .nvmrc 114 cache: yarn 115 116 - name: 📷 Check fingerprint and install dependencies 117 id: fingerprint 118 uses: bluesky-social/github-actions/fingerprint-native@main 119 with: 120 profile: pull-request 121 122 - name: 💬 Drop a comment 123 uses: marocchino/sticky-pull-request-comment@v2 124 if: ${{ steps.fingerprint.outputs.includes-changes }} 125 with: 126 header: fingerprint-diff 127 message: | 128 The Pull Request introduced fingerprint changes against the base commit: 129 <details><summary>Fingerprint diff</summary> 130 131 ```json 132 ${{ steps.fingerprint.outputs.diff }} 133 ``` 134 135 </details> 136 137 --- 138 *Generated by [PR labeler](https://github.com/expo/expo/actions/workflows/pr-labeler.yml) 🤖* 139 140 - name: 💬 Delete comment 141 uses: marocchino/sticky-pull-request-comment@v2 142 if: ${{ !steps.fingerprint.outputs.includes-changes }} 143 with: 144 header: fingerprint-diff 145 delete: true 146