Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds Actions to automatically add/remove S-ready from PRs #691

Merged
merged 6 commits into from
Feb 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
37 changes: 37 additions & 0 deletions .github/workflows/pr-postbuild.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: PR Post Build
on:
workflow_run:
workflows: [PR Build]
types:
- completed
jobs:
postbuild:
name: Update PR
runs-on: ubuntu-latest
if: github.event.workflow_run.conclusion == 'success'
steps:
- name: Install Python modules
run: pip install PyGithub
- name: Update PR
run: |
from github import Auth, Github
import json

event = json.loads('${{ toJSON(github.event) }}')
gh = Github(auth=Auth.Token("${{ secrets.GITHUB_TOKEN }}"))
repo = gh.get_repo("${{ github.repository }}")

for pull in event["workflow_run"]["pull_requests"]:
author = pull["head"]["repo"]["name"]
head = pull["head"]["sha"]
cmp = repo.compare(pull["base"]["ref"], f"{author}:{head}")

if cmp.status != "behind":
pull = repo.get_pull(pull["number"])
ready = False
for label in pull.labels:
if label.name == "S-ready":
ready = True
if not ready:
pull.add_to_labels("S-ready")
shell: python
24 changes: 15 additions & 9 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,24 @@ 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
12 changes: 0 additions & 12 deletions .github/workflows/qc-prebuild.yml

This file was deleted.