Skip to content

Commit 2810253

Browse files
kahestlucas-zimermankrystofwoldrich
authored
chore: Add action to warn about potentially risky PR changes (#4129)
Co-authored-by: LucasZF <[email protected]> Co-authored-by: Krystof Woldrich <[email protected]>
1 parent ad495e2 commit 2810253

File tree

2 files changed

+68
-0
lines changed

2 files changed

+68
-0
lines changed

.github/file-filters.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# This is used by the action https://github.com/dorny/paths-filter
2+
3+
high_risk_code: &high_risk_code
4+
# React Native Interface
5+
- 'src/js/vendor/react-native/index.ts'
6+
- 'src/js/utils/rnlibraries.ts'
7+
- 'src/js/utils/rnlibrariesinterface.ts'
8+
9+
# Touch Integration
10+
- 'src/js/touchevents.tsx'
11+
12+
# Sentry Native Interface
13+
- 'src/js/NativeRNSentry.ts'
14+
15+
# Source Maps and Native Debug Files Autoupload
16+
- 'scripts/sentry-xcode.sh'
17+
- 'scripts/sentry-xcode-debug-files.sh'
18+
- 'sentry.gradle'
19+
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Changes In High Risk Code
2+
on:
3+
pull_request:
4+
5+
# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value
6+
concurrency:
7+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
8+
cancel-in-progress: true
9+
10+
jobs:
11+
files-changed:
12+
name: Detect changed files
13+
runs-on: ubuntu-latest
14+
# Map a step output to a job output
15+
outputs:
16+
high_risk_code: ${{ steps.changes.outputs.high_risk_code }}
17+
high_risk_code_files: ${{ steps.changes.outputs.high_risk_code_files }}
18+
steps:
19+
- uses: actions/checkout@v4
20+
- name: Get changed files
21+
id: changes
22+
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
23+
with:
24+
token: ${{ github.token }}
25+
filters: .github/file-filters.yml
26+
27+
# Enable listing of files matching each filter.
28+
# Paths to files will be available in `${FILTER_NAME}_files` output variable.
29+
list-files: csv
30+
31+
validate-high-risk-code:
32+
if: needs.files-changed.outputs.high_risk_code == 'true'
33+
needs: files-changed
34+
runs-on: ubuntu-latest
35+
steps:
36+
- name: Comment on PR to notify of changes in high risk files
37+
uses: actions/github-script@v7
38+
env:
39+
high_risk_code: ${{ needs.files-changed.outputs.high_risk_code_files }}
40+
with:
41+
script: |
42+
const highRiskFiles = process.env.high_risk_code;
43+
const fileList = highRiskFiles.split(',').map(file => `- [ ] ${file}`).join('\n');
44+
github.rest.issues.createComment({
45+
issue_number: context.issue.number,
46+
owner: context.repo.owner,
47+
repo: context.repo.repo,
48+
body: `### 🚨 Detected changes in high risk code 🚨 \n High-risk code has higher potential to break the SDK and may be hard to test. To prevent severe bugs, apply the rollout process for releasing such changes and be extra careful when changing and reviewing these files:\n ${fileList}`
49+
})

0 commit comments

Comments
 (0)