Skip to content

Commit 4138901

Browse files
authored
Merge pull request #14473 from woocommerce/issue/woomob-1047-dependabot-github-action-with-warning-about-constraint
Add GitHub warning to constraint layout dependency updates
2 parents 16bc6c2 + 2a23466 commit 4138901

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Dependabot POS Reminder
2+
3+
on:
4+
pull_request:
5+
types: [opened, reopened]
6+
7+
jobs:
8+
add-pos-reminder:
9+
runs-on: ubuntu-latest
10+
if: github.actor == 'dependabot[bot]'
11+
12+
steps:
13+
# Check if PR contains the constraintlayout dependency
14+
- name: Check for ConstraintLayout Compose dependency
15+
id: check-dependency
16+
uses: actions/github-script@v7
17+
with:
18+
script: |
19+
const title = context.payload.pull_request.title;
20+
const body = context.payload.pull_request.body;
21+
const searchTerm = 'androidx.constraintlayout:constraintlayout-compose';
22+
23+
const containsDependency =
24+
title.includes(searchTerm) ||
25+
body.includes(searchTerm);
26+
27+
console.log(`PR contains ${searchTerm}: ${containsDependency}`);
28+
return containsDependency;
29+
result-encoding: string
30+
31+
# Add comment if dependency is found
32+
- name: Comment on PR
33+
if: steps.check-dependency.outputs.result == 'true'
34+
uses: actions/github-script@v7
35+
with:
36+
script: |
37+
// Check if comment already exists to avoid duplicates
38+
const comments = await github.rest.issues.listComments({
39+
issue_number: context.issue.number,
40+
owner: context.repo.owner,
41+
repo: context.repo.repo
42+
});
43+
44+
const botComment = comments.data.find(comment =>
45+
comment.user.type === 'Bot' &&
46+
comment.body.includes('POS testing')
47+
);
48+
49+
if (!botComment) {
50+
const commentBody = `## ⚠️ POS Testing Required
51+
52+
This PR updates \`androidx.constraintlayout:constraintlayout-compose\`, which affects the Point of Sale system.
53+
54+
**Required Testing:**
55+
- [ ] Cart items remain visible during checkout
56+
- [ ] Layout constraints work correctly on all screen sizes
57+
- [ ] No UI elements disappear unexpectedly
58+
59+
Please complete POS testing before merging this PR.`;
60+
61+
await github.rest.issues.createComment({
62+
issue_number: context.issue.number,
63+
owner: context.repo.owner,
64+
repo: context.repo.repo,
65+
body: commentBody
66+
});
67+
}

0 commit comments

Comments
 (0)