Skip to content

WIP/BLD: daff perms #14

WIP/BLD: daff perms

WIP/BLD: daff perms #14

Workflow file for this run

name: Comment Diff
on:
pull_request:
paths:
- 'Spreadsheet/**'
jobs:
comment-diff:
runs-on: ubuntu-20.04
defaults:
run:
# The following allows for each run step to utilize ~/.bash_profile
# for setting up the per-step initial state.
# --login: a login shell. Source ~/.bash_profile
# -e: exit on first error
# -o pipefail: piped processes are important; fail if they fail
shell: bash --login -eo pipefail {0}
permissions:
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- name: install requirements
run: |
pip install --upgrade pip
pip install daff
- name: make diff
id: make_diff
run: |
daff git csv
git config set --global diff.daff-csv.command "daff diff --git --output-format html --fragment --context 0"
git remote add target https://github.com/pcdshub/pcds-nalms.git
git fetch target
git diff target/${{ github.event.pull_request.base.ref }}...HEAD Spreadsheet/ > ${{ runner.temp }}/diff.txt
echo 'DIFF_OUTPUT<<EOF' > $GITHUB_OUTPUT
cat ${{ runner.temp }}/diff.txt >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
- name: make comment
id: make_comment
uses: actions/github-script@v7
env:
# set as env var to handle escaping
DIFF_OUTPUT: ${{ steps.make_diff.outputs.DIFF_OUTPUT }}
with:
script: |
github.reest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: process.env.DIFF_OUTPUT
})