Skip to content

Commit 3243f97

Browse files
authored
Merge pull request TeamNewPipe#10233 from TeamNewPipe/actions/mimmizer-pr
Minimize images in PR descriptions
2 parents c658f28 + d9e2ada commit 3243f97

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

.github/workflows/image-minimizer.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ module.exports = async ({github, context}) => {
1717
initialBody = context.payload.comment.body;
1818
} else if (context.eventName == 'issues') {
1919
initialBody = context.payload.issue.body;
20+
} else if (context.eventName == 'pull_request') {
21+
initialBody = context.payload.pull_request.body;
2022
} else {
2123
console.log('Aborting: No body found');
2224
return;
@@ -74,6 +76,14 @@ module.exports = async ({github, context}) => {
7476
repo: context.repo.repo,
7577
body: newBody
7678
});
79+
} else if (context.eventName == 'pull_request') {
80+
console.log('Updating pull request', context.payload.pull_request.number);
81+
await github.rest.pulls.update({
82+
pull_number: context.payload.pull_request.number,
83+
owner: context.repo.owner,
84+
repo: context.repo.repo,
85+
body: newBody
86+
});
7787
}
7888

7989
// Asnyc replace function from https://stackoverflow.com/a/48032528

.github/workflows/image-minimizer.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ on:
55
types: [created, edited]
66
issues:
77
types: [opened, edited]
8+
pull_request:
9+
types: [opened, edited]
810

911
permissions:
1012
issues: write

0 commit comments

Comments
 (0)