mirror of
https://github.com/Raghu-Ch/angular-challenges.git
synced 2026-02-10 04:43:03 -05:00
feat: improve github action
This commit is contained in:
6
.github/github-action/contributors.js
vendored
6
.github/github-action/contributors.js
vendored
@@ -8,9 +8,11 @@ const contributors = [
|
||||
'wandri',
|
||||
'webbomj',
|
||||
'kabrunko-dev',
|
||||
'Sanjar1304'
|
||||
'Sanjar1304',
|
||||
];
|
||||
|
||||
const sponsors = ['ddotx', 'LMFinney'];
|
||||
|
||||
module.exports = {
|
||||
contributors
|
||||
contributors,
|
||||
};
|
||||
|
||||
12
.github/github-action/index.js
vendored
12
.github/github-action/index.js
vendored
@@ -1,6 +1,6 @@
|
||||
const github = require('@actions/github');
|
||||
const core = require('@actions/core');
|
||||
const { contributors } = require('./contributors');
|
||||
const { contributors, sponsors } = require('./contributors');
|
||||
|
||||
async function run() {
|
||||
try {
|
||||
@@ -13,7 +13,13 @@ async function run() {
|
||||
}
|
||||
|
||||
const actor = github.context.actor;
|
||||
if(contributors.includes(actor)) {
|
||||
if (contributors.includes(actor)) {
|
||||
labels.push('contributor');
|
||||
labels.push('to be reviewed');
|
||||
}
|
||||
|
||||
if (sponsors.includes(actor)) {
|
||||
labels.push('sponsor');
|
||||
labels.push('to be reviewed');
|
||||
}
|
||||
|
||||
@@ -26,7 +32,7 @@ async function run() {
|
||||
labels,
|
||||
owner: github.context.repo.owner,
|
||||
repo: github.context.repo.repo,
|
||||
issue_number: number
|
||||
issue_number: number,
|
||||
});
|
||||
} catch (e) {
|
||||
if (e instanceof Error) {
|
||||
|
||||
14
.github/workflows/close-inactive-pr.yml
vendored
14
.github/workflows/close-inactive-pr.yml
vendored
@@ -1,7 +1,7 @@
|
||||
name: Close inactive issues
|
||||
on:
|
||||
schedule:
|
||||
- cron: '20 1 * * *'
|
||||
- cron: '0 0 * * *'
|
||||
|
||||
jobs:
|
||||
close-issues:
|
||||
@@ -10,18 +10,18 @@ jobs:
|
||||
issues: write
|
||||
pull-requests: write
|
||||
steps:
|
||||
- uses: actions/stale@v5
|
||||
- uses: actions/stale@v9
|
||||
with:
|
||||
days-before-issue-stale: 20
|
||||
days-before-issue-close: -1
|
||||
stale-issue-label: 'stale'
|
||||
stale-issue-message: 'This issue is stale because it has been open for 20 days with no activity.'
|
||||
stale-issue-message: 'This issue is stale because it has been open for 15 days with no activity.'
|
||||
exempt-issue-labels: 'long-term'
|
||||
days-before-pr-stale: 20
|
||||
days-before-pr-close: 7
|
||||
days-before-pr-stale: 15
|
||||
days-before-pr-close: 5
|
||||
stale-pr-label: 'stale'
|
||||
stale-pr-message: 'This pull request is stale because it has been open for 20 days with no activity.'
|
||||
close-pr-message: 'This pull request was closed because it has been inactive for 7 days since being marked as stale.'
|
||||
stale-pr-message: 'This pull request is stale because it has been open for 15 days with no activity.'
|
||||
close-pr-message: 'This pull request was closed because it has been inactive for 5 days since being marked as stale.'
|
||||
only-pr-labels: 'answer'
|
||||
exempt-pr-labels: 'challenge-creation, long-term'
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
import Default from '@astrojs/starlight/components/Hero.astro';
|
||||
import MyIcon from './MyIcon.astro';
|
||||
import { getEntry } from 'astro:content';
|
||||
import SponsorUser from './github/SponsorUser.svelte';
|
||||
|
||||
|
||||
const sponsorFetch = await fetch('https://ghs.vercel.app/v2/sponsors/tomalaforge');
|
||||
const { sponsors } = await sponsorFetch.json();
|
||||
|
||||
const { lang } = Astro.props;
|
||||
const { data } = await getEntry('i18n', lang);
|
||||
@@ -12,18 +12,7 @@ const { data } = await getEntry('i18n', lang);
|
||||
|
||||
<div class="sponsor-header button-hover">
|
||||
<p>{data['sponsors.description']}
|
||||
{sponsors.past.map(({username, avatar}) => (
|
||||
<a href=`https://github.com/${username}`>
|
||||
<img
|
||||
loading="lazy"
|
||||
src={avatar}
|
||||
width="40"
|
||||
height="40"
|
||||
alt={username}
|
||||
class="avatar"
|
||||
/>
|
||||
</a>
|
||||
))}
|
||||
<SponsorUser client:load />
|
||||
</p>
|
||||
<a class="action-button" href="https://github.com/sponsors/tomalaforge">
|
||||
<div>{data['sponsors.joinButton']}</div>
|
||||
@@ -57,14 +46,6 @@ const { data } = await getEntry('i18n', lang);
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.avatar {
|
||||
border-radius: 50%;
|
||||
width: 30px;
|
||||
height: auto;
|
||||
vertical-align: middle;
|
||||
margin-right: 0.5rem;
|
||||
}
|
||||
|
||||
.action-button {
|
||||
display: flex !important;
|
||||
justify-content: center;
|
||||
|
||||
36
docs/src/components/github/SponsorUser.svelte
Normal file
36
docs/src/components/github/SponsorUser.svelte
Normal file
@@ -0,0 +1,36 @@
|
||||
<script>
|
||||
import { onMount } from 'svelte';
|
||||
|
||||
|
||||
let sponsors = [];
|
||||
|
||||
onMount(async () => {
|
||||
const sponsorFetch = await fetch('https://ghs.vercel.app/v2/sponsors/tomalaforge');
|
||||
const data = await sponsorFetch.json();
|
||||
sponsors = data.sponsors.past;
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
{#each sponsors as { username, avatar }}
|
||||
<a href={`https://github.com/${username}`}>
|
||||
<img
|
||||
loading="lazy"
|
||||
src={avatar}
|
||||
width="40"
|
||||
height="40"
|
||||
alt={username}
|
||||
class="avatar"
|
||||
/>
|
||||
</a>
|
||||
{/each}
|
||||
|
||||
<style>
|
||||
.avatar {
|
||||
border-radius: 50%;
|
||||
width: 30px;
|
||||
height: auto;
|
||||
vertical-align: middle;
|
||||
margin-right: 0.5rem;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user