Bluesky app fork with some witchin' additions 💫
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add package diff PR labeler (#3212)

* add PR labeler

* test cache

* rm change

authored by

Hailey and committed by
GitHub
fa8b21ce e30b3d9b

+185
+185
.github/workflows/pull-request-commit.yml
··· 1 + # Credit https://github.com/expo/expo 2 + # https://github.com/expo/expo/blob/main/.github/workflows/pr-labeler.yml 3 + --- 4 + name: PR labeler 5 + 6 + on: 7 + push: 8 + branches: [main] 9 + pull_request: 10 + types: [opened, synchronize] 11 + 12 + concurrency: 13 + group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }} 14 + cancel-in-progress: true 15 + 16 + jobs: 17 + test-suite-fingerprint: 18 + runs-on: ubuntu-22.04 19 + if: ${{ github.event.pull_request.head.repo.full_name == github.repository || github.event_name == 'push' }} 20 + # REQUIRED: limit concurrency when pushing main(default) branch to prevent conflict for this action to update its fingerprint database 21 + concurrency: fingerprint-${{ github.event_name != 'pull_request' && 'main' || github.run_id }} 22 + permissions: 23 + # REQUIRED: Allow comments of PRs 24 + pull-requests: write 25 + # REQUIRED: Allow updating fingerprint in acton caches 26 + actions: write 27 + steps: 28 + - name: ⬇️ Checkout 29 + uses: actions/checkout@v4 30 + with: 31 + fetch-depth: 100 32 + 33 + - name: ⬇️ Fetch commits from base branch 34 + run: git fetch origin main:main --depth 100 35 + if: github.event_name == 'pull_request' 36 + 37 + - name: 🔧 Setup Node 38 + uses: actions/setup-node@v4 39 + with: 40 + node-version-file: .nvmrc 41 + cache: yarn 42 + 43 + - name: ⚙️ Install Dependencies 44 + run: yarn install 45 + 46 + - name: Get the base commit 47 + id: base-commit 48 + run: | 49 + # Since we limit this pr-labeler workflow only triggered from limited paths, we should use custom base commit 50 + echo base-commit=$(git log -n 1 main --pretty=format:'%H' -- .github/workflows/pr-labeler.yml packages yarn.lock) >> "$GITHUB_OUTPUT" 51 + 52 + - name: 📷 Check fingerprint 53 + id: fingerprint 54 + uses: expo/expo-github-action/fingerprint@main 55 + with: 56 + previous-git-commit: ${{ steps.base-commit.outputs.base-commit }} 57 + 58 + - name: 👀 Debug fingerprint 59 + run: | 60 + echo "previousGitCommit=${{ steps.fingerprint.outputs.previous-git-commit }} currentGitCommit=${{ steps.fingerprint.outputs.current-git-commit }}" 61 + echo "isPreviousFingerprintEmpty=${{ steps.fingerprint.outputs.previous-fingerprint == '' }}" 62 + 63 + - name: 🏷️ Labeling PR 64 + uses: actions/github-script@v6 65 + if: ${{ github.event_name == 'pull_request' && steps.fingerprint.outputs.fingerprint-diff == '[]' }} 66 + with: 67 + script: | 68 + try { 69 + await github.rest.issues.removeLabel({ 70 + issue_number: context.issue.number, 71 + owner: context.repo.owner, 72 + repo: context.repo.repo, 73 + name: ['bot: fingerprint changed'] 74 + }) 75 + } catch (e) { 76 + if (e.status != 404) { 77 + throw e; 78 + } 79 + } 80 + github.rest.issues.addLabels({ 81 + issue_number: context.issue.number, 82 + owner: context.repo.owner, 83 + repo: context.repo.repo, 84 + labels: ['bot: fingerprint compatible'] 85 + }) 86 + 87 + - name: 🏷️ Labeling PR 88 + uses: actions/github-script@v6 89 + if: ${{ github.event_name == 'pull_request' && steps.fingerprint.outputs.fingerprint-diff != '[]' }} 90 + with: 91 + script: | 92 + try { 93 + await github.rest.issues.removeLabel({ 94 + issue_number: context.issue.number, 95 + owner: context.repo.owner, 96 + repo: context.repo.repo, 97 + name: ['bot: fingerprint compatible'] 98 + }) 99 + } catch (e) { 100 + if (e.status != 404) { 101 + throw e; 102 + } 103 + } 104 + github.rest.issues.addLabels({ 105 + issue_number: context.issue.number, 106 + owner: context.repo.owner, 107 + repo: context.repo.repo, 108 + labels: ['bot: fingerprint changed'] 109 + }) 110 + 111 + - name: 🔍 Find old comment if it exists 112 + uses: peter-evans/find-comment@v2 113 + if: ${{ github.event_name == 'pull_request' }} 114 + id: old_comment 115 + with: 116 + issue-number: ${{ github.event.pull_request.number }} 117 + comment-author: 'expo-bot' 118 + body-includes: <!-- pr-labeler comment --> 119 + 120 + - name: 💬 Add comment with fingerprint 121 + if: ${{ github.event_name == 'pull_request' && steps.fingerprint.outputs.fingerprint-diff != '[]' && steps.old_comment.outputs.comment-id == '' }} 122 + uses: actions/github-script@v6 123 + with: 124 + script: | 125 + const diff = JSON.stringify(${{ steps.fingerprint.outputs.fingerprint-diff}}, null, 2); 126 + const body = `<!-- pr-labeler comment --> 127 + The Pull Request introduced fingerprint changes against the base commit: ${{ steps.fingerprint.outputs.previous-git-commit }} 128 + <details><summary>Fingerprint diff</summary> 129 + 130 + \`\`\`json 131 + ${diff} 132 + \`\`\` 133 + 134 + </details> 135 + 136 + --- 137 + *Generated by [PR labeler](https://github.com/expo/expo/actions/workflows/pr-labeler.yml) 🤖* 138 + `; 139 + 140 + github.rest.issues.createComment({ 141 + issue_number: context.issue.number, 142 + owner: context.repo.owner, 143 + repo: context.repo.repo, 144 + body: body, 145 + }); 146 + 147 + - name: 💬 Update comment with fingerprint 148 + if: ${{ github.event_name == 'pull_request' && steps.fingerprint.outputs.fingerprint-diff != '[]' && steps.old_comment.outputs.comment-id != '' }} 149 + uses: actions/github-script@v6 150 + with: 151 + script: | 152 + const diff = JSON.stringify(${{ steps.fingerprint.outputs.fingerprint-diff}}, null, 2); 153 + const body = `<!-- pr-labeler comment --> 154 + The Pull Request introduced fingerprint changes against the base commit: ${{ steps.fingerprint.outputs.previous-git-commit }} 155 + <details><summary>Fingerprint diff</summary> 156 + 157 + \`\`\`json 158 + ${diff} 159 + \`\`\` 160 + 161 + </details> 162 + 163 + --- 164 + *Generated by [PR labeler](https://github.com/expo/expo/actions/workflows/pr-labeler.yml) 🤖* 165 + `; 166 + 167 + github.rest.issues.updateComment({ 168 + issue_number: context.issue.number, 169 + comment_id: '${{ steps.old_comment.outputs.comment-id }}', 170 + owner: context.repo.owner, 171 + repo: context.repo.repo, 172 + body: body, 173 + }); 174 + 175 + - name: 💬 Delete comment with fingerprint 176 + if: ${{ github.event_name == 'pull_request' && steps.fingerprint.outputs.fingerprint-diff == '[]' && steps.old_comment.outputs.comment-id != '' }} 177 + uses: actions/github-script@v6 178 + with: 179 + script: | 180 + github.rest.issues.deleteComment({ 181 + issue_number: context.issue.number, 182 + comment_id: '${{ steps.old_comment.outputs.comment-id }}', 183 + owner: context.repo.owner, 184 + repo: context.repo.repo, 185 + });