Skip to content

Commit

Permalink
Uses Python instead of JS on Housekeep Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
ultimaweapon committed Feb 24, 2024
1 parent e8954ef commit f13000f
Showing 1 changed file with 10 additions and 23 deletions.
33 changes: 10 additions & 23 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,30 +18,17 @@ jobs:
name: Housekeep
runs-on: ubuntu-latest
steps:
- name: Install Node packages
run: sudo npm install -g octokit
- name: Update PRs
run: |
import { Octokit } from 'octokit';
from datetime import datetime
from github import Auth, Github
const octokit = new Octokit({ auth: '${{ secrets.GITHUB_TOKEN }}' });
const owner = '${{ github.event.repository.owner.login }}';
const repo = '${{ github.event.repository.name }}';
const resp = await octokit.request('GET /repos/{owner}/{repo}/pulls', {
owner,
repo,
base: '${{ github.ref_name }}',
sort: 'updated',
direction: 'desc',
per_page: 100,
});
now = datetime.now()
gh = Github(auth=Auth.Token("${{ secrets.GITHUB_TOKEN }}"))
repo = gh.get_repo("${{ github.repository }}")
for (const pull of resp.data) {
await octokit.request('POST /repos/{owner}/{repo}/issues/{issue_number}/labels', {
owner,
repo,
issue_number: pull.number,
labels: ['B-out-of-date'],
});
}
shell: node --experimental-default-type=module {0}
for pull in repo.get_pulls("open", "updated", "desc", "${{ github.ref_name }}"):
if (now - pull.updated_at).days > 30:
break
pull.add_to_labels("B-out-of-date")
shell: python

0 comments on commit f13000f

Please sign in to comment.