mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-18 20:36:04 +00:00
Combine authorship validation with the required APK result (#1329)
Combine trusted source and squash-metadata validation with the exact-head APK compilation result. Preserve automatic trailer cleanup in the installed hooks. Validated with 10 authorship/hook tests and 9 combined-gate tests.
This commit is contained in:
1 parent
701e70bd3e
commit
792a69ebfe
4 files changed
+230
-35
No files matched your search
@@ -1,58 +1,40 @@
|
||||
name: Human authorship
|
||||
name: Build validation
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
branches: [main]
|
||||
types: [opened, synchronize, reopened, edited, ready_for_review]
|
||||
push:
|
||||
branches: [main]
|
||||
workflow_run:
|
||||
workflows: [Build APK]
|
||||
types: [completed]
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
pr_number:
|
||||
description: Pull request to validate; empty for main
|
||||
required: false
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
actions: read
|
||||
pull-requests: read
|
||||
statuses: write
|
||||
|
||||
jobs:
|
||||
authorship:
|
||||
name: Validate human authorship
|
||||
validate:
|
||||
name: Build APK
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 5
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event.repository.default_branch }}
|
||||
ref: ${{ github.workflow_sha }}
|
||||
fetch-depth: 0
|
||||
persist-credentials: false
|
||||
- name: Check the proposed or merged history
|
||||
id: validate
|
||||
- name: Validate source and APK compilation
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
EVENT_NAME: ${{ github.event_name }}
|
||||
PR_NUMBER: ${{ github.event.pull_request.number }}
|
||||
BEFORE: ${{ github.event.before }}
|
||||
AFTER: ${{ github.sha }}
|
||||
PR_HEAD: ${{ github.event.pull_request.head.sha }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
if [ "$EVENT_NAME" = pull_request_target ]; then
|
||||
gh auth setup-git
|
||||
git fetch --no-tags origin "refs/pull/$PR_NUMBER/head"
|
||||
test "$(git rev-parse FETCH_HEAD)" = "$PR_HEAD"
|
||||
base=$(git merge-base HEAD FETCH_HEAD)
|
||||
python3 tools/release/check_authorship.py "$base..FETCH_HEAD" --event "$GITHUB_EVENT_PATH"
|
||||
elif [ "$EVENT_NAME" = push ] && [ "$BEFORE" != 0000000000000000000000000000000000000000 ]; then
|
||||
python3 tools/release/check_authorship.py "$BEFORE..$AFTER"
|
||||
else
|
||||
python3 tools/release/check_authorship.py HEAD
|
||||
fi
|
||||
- name: Publish the required result on the actual proposed commit
|
||||
if: always()
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
TARGET_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
|
||||
RESULT: ${{ steps.validate.outcome == 'success' && 'success' || 'failure' }}
|
||||
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
||||
run: |
|
||||
gh api --method POST "repos/$GITHUB_REPOSITORY/statuses/$TARGET_SHA" \
|
||||
-f context='Human authorship' -f state="$RESULT" -f target_url="$RUN_URL" \
|
||||
-f description='Bot authors and bot co-author trailers are forbidden'
|
||||
gh auth setup-git
|
||||
python3 tools/release/validate_apk.py
|
||||
Reference in new issue
Block a user