Reqvire Impact on PR Comment #8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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: | |
| fetch-depth: 0 # needed for full commit history | |
| - name: Install Rust toolchain | |
| uses: actions-rs/toolchain@v1 | |
| with: | |
| toolchain: stable | |
| override: true | |
| - name: Build reqflowcli from source | |
| run: | | |
| cargo build --release | |
| cp target/release/reqflow ./reqflow | |
| - name: Compute merge base commit | |
| id: base_commit | |
| run: | | |
| BASE_BRANCH="${{ github.event.issue.pull_request.base.ref }}" | |
| echo "Using base branch: $BASE_BRANCH" | |
| 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: Run ReqFlow Change Impact against PR base | |
| id: run_reqflow | |
| run: | | |
| 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: | | |
| 🧠 **ReqFlow Change Impact Report** | |
| Triggered by `${{ github.event.comment.user.login }}` via `/reqflow impact`. | |
| <details> | |
| <summary>Click to expand</summary> | |
| ``` | |
| ${{ env.REQFLOW_OUTPUT }} | |
| ``` | |
| </details> | |