-
Notifications
You must be signed in to change notification settings - Fork 3
79 lines (64 loc) · 2.3 KB
/
change_impact.yml
File metadata and controls
79 lines (64 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
69
70
71
72
73
74
75
76
77
78
79
name: ReqFlow Impact on PR Comment
on:
issue_comment:
types: [created]
jobs:
run-change-impact:
if: |
github.event.issue.pull_request != null &&
contains(github.event.comment.body, '/reqflow impact')
runs-on: ubuntu-latest
permissions:
pull-requests: write
issues: write
contents: read
steps:
- name: React to trigger comment with
uses: peter-evans/create-or-update-comment@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
comment-id: ${{ github.event.comment.id }}
reactions: '+1'
- name: Checkout PR source branch
uses: actions/checkout@v4
with:
ref: ${{ github.event.issue.pull_request.head.ref }}
fetch-depth: 0 # needed for full commit history
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Get Base Branch from PR using gh
id: get_pr_base
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
BASE_BRANCH=$(gh pr view ${{ github.event.issue.number }} --json baseRefName --jq '.baseRefName')
echo "Using base branch: $BASE_BRANCH"
echo "BASE_BRANCH=$BASE_BRANCH" >> $GITHUB_ENV
- name: Compute merge base commit
id: base_commit
run: |
git fetch origin "$BASE_BRANCH"
BASE_COMMIT=$(git merge-base origin/"$BASE_BRANCH" HEAD)
echo "Base commit: $BASE_COMMIT"
echo "BASE_COMMIT=$BASE_COMMIT" >> $GITHUB_ENV
- name: Build reqflowcli from source
run: |
cargo build --release
cp target/release/reqflow ./reqflow
- name: Run ReqFlow Change Impact against PR base
id: run_reqflow
run: |
mkdir output
OUTPUT=$(./reqflow --change-impact --git-commit "$BASE_COMMIT" 2>&1 || echo "⚠️ reqflow failed.")
echo "REQFLOW_OUTPUT<<EOF" >> $GITHUB_ENV
echo "$OUTPUT" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Comment on PR with result
uses: peter-evans/create-or-update-comment@v3
with:
issue-number: ${{ github.event.issue.number }}
body: |
${{ env.REQFLOW_OUTPUT }}