mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-11-10 04:54:03 -08:00
59 lines
1.9 KiB
YAML
59 lines
1.9 KiB
YAML
name: Close Themes PR
|
|
on:
|
|
pull_request:
|
|
types: [opened, reopened, edited]
|
|
|
|
jobs:
|
|
publish:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code 👋
|
|
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
|
|
- name: Check and close 🔐
|
|
uses: actions/github-script@d556feaca394842dc55e4734bf3bb9f685482fa0
|
|
with:
|
|
github-token: ${{ secrets.GH_PAT }}
|
|
script: |
|
|
const { repo: { owner, repo } } = context;
|
|
const pr = context.payload.pull_request;
|
|
|
|
const response = await github.rest.pulls.listFiles({
|
|
owner, repo,
|
|
pull_number: pr.number
|
|
});
|
|
|
|
if (response.status !== 200) {
|
|
console.log('Could not fetch files');
|
|
return;
|
|
}
|
|
|
|
let hasThemeAdditions = false;
|
|
for (const file of response.data) {
|
|
const name = file.filename
|
|
console.log(`File: ${name}`);
|
|
if (file.status === 'added' && name.includes('themes/')) {
|
|
console.log(`File: ${name} is a theme addition`);
|
|
hasThemeAdditions = true;
|
|
break;
|
|
}
|
|
}
|
|
|
|
if (!hasThemeAdditions) {
|
|
console.log('No theme additions found.');
|
|
return;
|
|
}
|
|
|
|
const body = `👋 @${pr.user.login}, theme aditions are no longer accepted due to the ever growing set. We do however accept showcasing your custom theme in the [🎨 Themes section](https://github.com/JanDeDobbeleer/oh-my-posh/discussions/categories/themes) in discussions.`
|
|
|
|
await github.rest.issues.createComment({
|
|
owner, repo,
|
|
issue_number: pr.number,
|
|
body,
|
|
});
|
|
|
|
await github.rest.pulls.update({
|
|
owner, repo,
|
|
pull_number: pr.number,
|
|
state: "closed",
|
|
});
|