-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
68 lines (68 loc) · 2.3 KB
/
Copy pathaction.yml
File metadata and controls
68 lines (68 loc) · 2.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
name: "Loadpath Review"
description: "Review a pull request as a load path and fail the check on blockers or low confidence."
author: Loadpath
branding:
icon: git-pull-request
color: purple
inputs:
fail-on:
description: "Gate: never, blocker, low, or medium. blocker fails on architecture blockers; low also fails on low confidence; medium fails unless confidence is high."
required: false
default: "blocker"
comment:
description: "Post or update the single Loadpath brief on the pull request."
required: false
default: "true"
python-version:
description: "Python version used to install Loadpath."
required: false
default: "3.12"
outputs:
level:
description: "Confidence level (high, medium, low)."
value: ${{ steps.review.outputs.level }}
passed:
description: "Whether the gate passed."
value: ${{ steps.review.outputs.passed }}
title:
description: "Review title."
value: ${{ steps.review.outputs.title }}
contract_break:
description: "none, additive, breaking, or drift."
value: ${{ steps.review.outputs.contract_break }}
runs:
using: composite
steps:
- uses: actions/setup-python@v7
with:
python-version: ${{ inputs.python-version }}
- name: Install Loadpath
shell: bash
run: python -m pip install --quiet "${{ github.action_path }}"
- name: Index
shell: bash
run: loadpath index .
- name: Review
id: review
shell: bash
env:
GITHUB_TOKEN: ${{ github.token }}
LOADPATH_FAIL_ON: ${{ inputs.fail-on }}
LOADPATH_COMMENT: ${{ inputs.comment }}
LOADPATH_PR: ${{ github.event.pull_request.number }}
LOADPATH_REPO: ${{ github.repository }}
LOADPATH_BASE_REF: ${{ github.base_ref }}
run: |
set -euo pipefail
case "${LOADPATH_FAIL_ON}" in
never|blocker|low|medium) ;;
*)
echo "fail-on must be never, blocker, low, or medium" >&2
exit 1
;;
esac
ARGS=(review . --base "origin/${LOADPATH_BASE_REF:-main}" --head HEAD --fail-on "${LOADPATH_FAIL_ON}")
if [ "${LOADPATH_COMMENT}" = "true" ] && [ -n "${LOADPATH_PR}" ]; then
ARGS+=(--comment --provider github --pr "${LOADPATH_PR}" --repo "${LOADPATH_REPO}")
fi
loadpath "${ARGS[@]}"