interplane.Get Omega
Read in your language

omega-projects

aien-dev/omega-projects

Brought by drakestapleton

branch main Branches Tags History

omega-projects / .github / workflows / project-checks.yml

36 lines · 1499 bytes Raw Blame History
1# Checks every pull request to main with .github/check_projects.py.
2# pull_request only (never pull_request_target): the run gets a read-only token and no
3# secrets, and no action is used at all: plain git and python3 from the runner image.
4# The checker comes from main, so a pull request cannot loosen the rules it is checked by.
5name: project checks
6on:
7 pull_request:
8 branches: [main]
9permissions:
10 contents: read
11concurrency:
12 group: project-checks-${{ github.event.pull_request.number }}
13 cancel-in-progress: true
14jobs:
15 check:
16 runs-on: ubuntu-24.04
17 timeout-minutes: 5
18 steps:
19 - name: Check the pull request's files
20 env:
21 PR: ${{ github.event.pull_request.number }}
22 REPO: ${{ github.repository }}
23 HEAD_REF: ${{ github.head_ref }}
24 run: |
25 set -eu
26 git init -q work && cd work
27 url="https://github.com/$REPO"
28 git fetch -q --no-tags --depth=2 "$url" "+refs/pull/$PR/merge:refs/check/pr"
29 git fetch -q --no-tags --depth=1 "$url" "+refs/heads/main:refs/check/main"
30 if git cat-file -e refs/check/main:.github/check_projects.py 2>/dev/null; then
31 git show refs/check/main:.github/check_projects.py > ../check.py
32 else
33 echo "main has no checker yet; using this pull request's copy"
34 git show refs/check/pr:.github/check_projects.py > ../check.py
35 fi
36 python3 ../check.py refs/check/pr^1 refs/check/pr "$HEAD_REF"