Adds Actions to automatically add/remove S-ready from PRs #1507
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: PR Build | |
on: | |
pull_request: | |
branches: | |
- '*' | |
concurrency: pr-${{ github.ref }} | |
jobs: | |
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 | |
needs: prebuild | |
build-linux: | |
name: Build | |
uses: ./.github/workflows/ci-linux.yml | |
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] | |
permissions: | |
pull-requests: write | |
steps: | |
- name: Install Python modules | |
run: pip install PyGithub | |
- name: Update PR | |
run: | | |
from github import Auth, Github | |
author = "${{ github.event.pull_request.head.user.login }}" | |
head = "${{ github.event.pull_request.head.sha }}" | |
gh = Github(auth=Auth.Token("${{ secrets.GITHUB_TOKEN }}")) | |
repo = gh.get_repo("${{ github.repository }}") | |
cmp = repo.compare("${{ github.base_ref }}", f"{author}:{head}") | |
if cmp.status != "behind": | |
pull = repo.get_pull(${{ github.event.number }}) | |
pull.add_to_labels("S-ready") | |
shell: python |