Skip to content

Commit

Permalink
Adds Actions to automatically add/remove S-ready from PRs
Browse files Browse the repository at this point in the history
  • Loading branch information
ultimaweapon committed Feb 24, 2024
1 parent 7c306e6 commit c117017
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 26 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@ jobs:
for pull in repo.get_pulls("open", "updated", "desc", "${{ github.ref_name }}"):
if (now - pull.updated_at).days > 30:
break
ood = False
ready = False
for label in pull.labels:
if label.name == "B-out-of-date":
ood = True
if not ood:
pull.add_to_labels("B-out-of-date")
if label.name == "S-ready":
ready = True
if ready:
print(f"Removing S-ready from {pull.title}")
pull.remove_from_labels("S-ready")
shell: python
43 changes: 34 additions & 9 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,43 @@ on:
- '*'
concurrency: pr-${{ github.ref }}
jobs:
quality-checks:
name: Pre-Build
uses: ./.github/workflows/qc-prebuild.yml
windows:
needs: quality-checks
prebuild:
name: Pre build
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Check Rust styles
run: cargo fmt --check
working-directory: src
build-windows:
name: Build
uses: ./.github/workflows/ci-windows.yml
linux:
needs: quality-checks
needs: prebuild
build-linux:
name: Build
uses: ./.github/workflows/ci-linux.yml
mac:
needs: quality-checks
needs: prebuild
build-mac:
name: Build
uses: ./.github/workflows/ci-mac.yml
needs: prebuild
postbuild:
name: Post build
runs-on: ubuntu-latest
needs: [build-windows, build-linux, build-mac]
steps:
- name: Install Python modules
run: pip install PyGithub
- name: Update PR
run: |
from github import Auth, Github
gh = Github(auth=Auth.Token("${{ secrets.GITHUB_TOKEN }}"))
repo = gh.get_repo("${{ github.repository }}")
cmp = repo.compare("${{ github.base_ref }}", "${{ github.head_ref }}")
if cmp.status != "behind":
pull = repo.get_pull(${{ github.event.number }})
pull.add_to_labels("S-ready")
shell: python
12 changes: 0 additions & 12 deletions .github/workflows/qc-prebuild.yml

This file was deleted.

0 comments on commit c117017

Please sign in to comment.