mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2024-12-23 08:30:44 +00:00
Merge pull request #10233 from TeamNewPipe/actions/mimmizer-pr
Minimize images in PR descriptions
This commit is contained in:
commit
3243f97ff2
10
.github/workflows/image-minimizer.js
vendored
10
.github/workflows/image-minimizer.js
vendored
@ -17,6 +17,8 @@ module.exports = async ({github, context}) => {
|
|||||||
initialBody = context.payload.comment.body;
|
initialBody = context.payload.comment.body;
|
||||||
} else if (context.eventName == 'issues') {
|
} else if (context.eventName == 'issues') {
|
||||||
initialBody = context.payload.issue.body;
|
initialBody = context.payload.issue.body;
|
||||||
|
} else if (context.eventName == 'pull_request') {
|
||||||
|
initialBody = context.payload.pull_request.body;
|
||||||
} else {
|
} else {
|
||||||
console.log('Aborting: No body found');
|
console.log('Aborting: No body found');
|
||||||
return;
|
return;
|
||||||
@ -74,6 +76,14 @@ module.exports = async ({github, context}) => {
|
|||||||
repo: context.repo.repo,
|
repo: context.repo.repo,
|
||||||
body: newBody
|
body: newBody
|
||||||
});
|
});
|
||||||
|
} else if (context.eventName == 'pull_request') {
|
||||||
|
console.log('Updating pull request', context.payload.pull_request.number);
|
||||||
|
await github.rest.pulls.update({
|
||||||
|
pull_number: context.payload.pull_request.number,
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
body: newBody
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Asnyc replace function from https://stackoverflow.com/a/48032528
|
// Asnyc replace function from https://stackoverflow.com/a/48032528
|
||||||
|
2
.github/workflows/image-minimizer.yml
vendored
2
.github/workflows/image-minimizer.yml
vendored
@ -5,6 +5,8 @@ on:
|
|||||||
types: [created, edited]
|
types: [created, edited]
|
||||||
issues:
|
issues:
|
||||||
types: [opened, edited]
|
types: [opened, edited]
|
||||||
|
pull_request:
|
||||||
|
types: [opened, edited]
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
issues: write
|
issues: write
|
||||||
|
Loading…
Reference in New Issue
Block a user