paperclip/.github/workflows/pr.yml

37 lines
1.1 KiB
YAML

name: PR
on:
pull_request:
permissions:
actions: read
contents: read
pull-requests: read
jobs:
branch-freshness:
name: branch-freshness
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Verify head contains the triggering base
shell: bash
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
GH_TOKEN: ${{ github.token }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: |
set -euo pipefail
[[ "$BASE_SHA" =~ ^[0-9a-f]{40}$ ]]
[[ "$HEAD_SHA" =~ ^[0-9a-f]{40}$ ]]
comparison="$(curl --fail-with-body --silent --show-error \
--header "Accept: application/vnd.github+json" \
--header "Authorization: Bearer $GH_TOKEN" \
--header "X-GitHub-Api-Version: 2022-11-28" \
"https://api.github.com/repos/$GITHUB_REPOSITORY/compare/$BASE_SHA...$HEAD_SHA")"
jq --exit-status '.status == "ahead" or .status == "identical"' <<<"$comparison"
ci:
uses: paperclipai/paperclip/.github/workflows/pr-trusted.yml@39b8ee2960541d14b380f95365deecba6723d9bd