From 1a7919c0b95ea3b54d94ae0247bc01f84a48ac1f Mon Sep 17 00:00:00 2001 From: Kaushik Malapati Date: Sun, 8 Dec 2024 15:18:49 -0800 Subject: [PATCH 01/15] Adding new workflow to post comment with daff diff of csvs --- .github/workflows/daff.yml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/workflows/daff.yml diff --git a/.github/workflows/daff.yml b/.github/workflows/daff.yml new file mode 100644 index 0000000..e11c9b8 --- /dev/null +++ b/.github/workflows/daff.yml @@ -0,0 +1,32 @@ +name: Generate Daff + +on: + pull_request: + paths: + - 'CSV/**' + +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} + + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: install requirements + run: | + pip install --upgrade pip + pip install daff + - name: daff diff + run: | + daff git csv + gh pr comment $PRNUM --body-file < <(git diff XML/) From 04a156a385dc1513c3a23b4b1c2c14e527e67837 Mon Sep 17 00:00:00 2001 From: Kaushik Malapati Date: Mon, 9 Dec 2024 12:33:28 -0800 Subject: [PATCH 02/15] Testing what a csv change looks like --- Spreadsheet/KFE/TMO-alarms.csv | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Spreadsheet/KFE/TMO-alarms.csv b/Spreadsheet/KFE/TMO-alarms.csv index 6119878..c8e8d61 100644 --- a/Spreadsheet/KFE/TMO-alarms.csv +++ b/Spreadsheet/KFE/TMO-alarms.csv @@ -109,16 +109,16 @@ ,,pva://DAQ:NEH:tmo:0:Damage_bld,,,,, ,,pva://DAQ:NEH:tmo:0:Damage_epics,,,,, ,,pva://DAQ:NEH:tmo:0:Damage_atm,,,,, -1,SP1K4,,,,,, -,,SP1K4:PPM:CAM:TSS:SyncStatus,Camera Sync Status,,,SP1K4:PPM:CAM:TriggerMode_RBV!=0, -,,SP1K4:PPM:CAM:TSS:DiffVsIntAvg,Sync Diff,,,, 1,IM5K4,,,,,, -,,IM5K4:PPM:CAM:TSS:SyncStatus,Camera Sync Status,,,IM5K4:PPM:CAM:TriggerMode_RBV!=0, +,,IM5K4:PPM:CAM:TSS:SyncStatus,Reversed Polarity Accidentally,,,IM5K4:PPM:CAM:TriggerMode_RBV==0, ,,IM5K4:PPM:CAM:TSS:DiffVsIntAvg,Sync Diff,,,, 1,IM6K4,,,,,, ,,IM6K4:PPM:CAM:TSS:SyncStatus,Camera Sync Status,,,IM6K4:PPM:CAM:TriggerMode_RBV!=0, ,,IM6K4:PPM:CAM:TSS:DiffVsIntAvg,Sync Diff,,,, 0,TMO LASER,,,,,, -1,QADC,,,,,, +1,UADC,,,,,, ,,LM1K4:QADC:01:OUT0_EDGE1,QADC signal monitor,,,LM1K4:QADC:01:OUT0_EDGE1>0, ,,LM1K4:QADC:01:OUT0_EDGE2,QADC signal monitor,,,LM1K4:QADC:01:OUT0_EDGE2>0, +0,DAFF,,,,,, +1,New Row,,,,,,, +,,LM1K4:QADC:01:OUT0_EDGE1,QADC signal monitor,,,LM1K4:QADC:01:OUT0_EDGE1>0, From 2a66e8bc2a13ed14a6561f799fd7bb5a99a39c99 Mon Sep 17 00:00:00 2001 From: Kaushik Malapati Date: Mon, 9 Dec 2024 12:50:18 -0800 Subject: [PATCH 03/15] Fixing path --- .github/workflows/daff.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/daff.yml b/.github/workflows/daff.yml index e11c9b8..716e5de 100644 --- a/.github/workflows/daff.yml +++ b/.github/workflows/daff.yml @@ -3,7 +3,7 @@ name: Generate Daff on: pull_request: paths: - - 'CSV/**' + - 'Spreadsheet/**' jobs: comment-diff: From beb3077709fb9402d7a6cc4954f191b9c86669a2 Mon Sep 17 00:00:00 2001 From: Kaushik Malapati Date: Mon, 9 Dec 2024 12:55:20 -0800 Subject: [PATCH 04/15] Removing extra column --- Spreadsheet/KFE/TMO-alarms.csv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Spreadsheet/KFE/TMO-alarms.csv b/Spreadsheet/KFE/TMO-alarms.csv index c8e8d61..3f45456 100644 --- a/Spreadsheet/KFE/TMO-alarms.csv +++ b/Spreadsheet/KFE/TMO-alarms.csv @@ -120,5 +120,5 @@ ,,LM1K4:QADC:01:OUT0_EDGE1,QADC signal monitor,,,LM1K4:QADC:01:OUT0_EDGE1>0, ,,LM1K4:QADC:01:OUT0_EDGE2,QADC signal monitor,,,LM1K4:QADC:01:OUT0_EDGE2>0, 0,DAFF,,,,,, -1,New Row,,,,,,, +1,New Row,,,,,, ,,LM1K4:QADC:01:OUT0_EDGE1,QADC signal monitor,,,LM1K4:QADC:01:OUT0_EDGE1>0, From d17ac30059000795c687e06dc393008290be8d86 Mon Sep 17 00:00:00 2001 From: Kaushik Malapati Date: Mon, 9 Dec 2024 13:09:16 -0800 Subject: [PATCH 05/15] Removing redirect and fixing diff directory --- .github/workflows/daff.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/daff.yml b/.github/workflows/daff.yml index 716e5de..0037b71 100644 --- a/.github/workflows/daff.yml +++ b/.github/workflows/daff.yml @@ -29,4 +29,4 @@ jobs: - name: daff diff run: | daff git csv - gh pr comment $PRNUM --body-file < <(git diff XML/) + gh pr comment $PRNUM --body-file <(git diff Spreadsheet/) From 0891c2ce5c65da495b66533b18e34b523509158c Mon Sep 17 00:00:00 2001 From: Kaushik Malapati Date: Mon, 9 Dec 2024 13:14:25 -0800 Subject: [PATCH 06/15] Adding gh token to env --- .github/workflows/daff.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/daff.yml b/.github/workflows/daff.yml index 0037b71..a01bd68 100644 --- a/.github/workflows/daff.yml +++ b/.github/workflows/daff.yml @@ -27,6 +27,8 @@ jobs: pip install --upgrade pip pip install daff - name: daff diff + env: + GH_TOKEN: ${{ github.token }} run: | daff git csv gh pr comment $PRNUM --body-file <(git diff Spreadsheet/) From efcc2a3b6fe46811a99dfb09bee209926d15c865 Mon Sep 17 00:00:00 2001 From: Kaushik Malapati Date: Mon, 9 Dec 2024 13:31:00 -0800 Subject: [PATCH 07/15] Adding branch --- .github/workflows/daff.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/daff.yml b/.github/workflows/daff.yml index a01bd68..34b52e1 100644 --- a/.github/workflows/daff.yml +++ b/.github/workflows/daff.yml @@ -29,6 +29,7 @@ jobs: - name: daff diff env: GH_TOKEN: ${{ github.token }} + BRANCH: ${{ github.head_ref }} run: | daff git csv gh pr comment $PRNUM --body-file <(git diff Spreadsheet/) From 5f54e78e0bfdd7b5e8143e6013754d8162044ba0 Mon Sep 17 00:00:00 2001 From: Kaushik Malapati Date: Mon, 9 Dec 2024 13:45:47 -0800 Subject: [PATCH 08/15] Adding repo and prnum to repo --- .github/workflows/daff.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/daff.yml b/.github/workflows/daff.yml index 34b52e1..edd1d4c 100644 --- a/.github/workflows/daff.yml +++ b/.github/workflows/daff.yml @@ -29,7 +29,8 @@ jobs: - name: daff diff env: GH_TOKEN: ${{ github.token }} - BRANCH: ${{ github.head_ref }} + GH_REPO: ${{ github.repository }} + PRNUM: ${{ github.event.pull_request.number }} run: | daff git csv gh pr comment $PRNUM --body-file <(git diff Spreadsheet/) From be62532832ca810acb96ce038b54ff82f7a5bdcb Mon Sep 17 00:00:00 2001 From: Kaushik Malapati Date: Mon, 9 Dec 2024 14:24:36 -0800 Subject: [PATCH 09/15] Adding write permissions to token --- .github/workflows/daff.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/daff.yml b/.github/workflows/daff.yml index edd1d4c..091ab65 100644 --- a/.github/workflows/daff.yml +++ b/.github/workflows/daff.yml @@ -17,7 +17,8 @@ jobs: # -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@v3 with: From b716f3e87bf296a3078331d50a242b4e1919c1ef Mon Sep 17 00:00:00 2001 From: Kaushik Malapati Date: Tue, 10 Dec 2024 00:21:27 -0800 Subject: [PATCH 10/15] using action instead of gh cli to make comment --- .github/workflows/daff.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/daff.yml b/.github/workflows/daff.yml index 091ab65..d0a2293 100644 --- a/.github/workflows/daff.yml +++ b/.github/workflows/daff.yml @@ -1,14 +1,13 @@ name: Generate Daff on: - pull_request: + pull_request_target: paths: - 'Spreadsheet/**' jobs: comment-diff: runs-on: ubuntu-20.04 - defaults: run: # The following allows for each run step to utilize ~/.bash_profile @@ -27,11 +26,12 @@ jobs: run: | pip install --upgrade pip pip install daff - - name: daff diff - env: - GH_TOKEN: ${{ github.token }} - GH_REPO: ${{ github.repository }} - PRNUM: ${{ github.event.pull_request.number }} + - name: make diff run: | daff git csv - gh pr comment $PRNUM --body-file <(git diff Spreadsheet/) + git diff HEAD..origin/master > ${{ runner.temp }}/diff.txt + - name: make comment + uses: thollander/actions-comment-pull-request@v3 + with: + file-path: ${{ runner.temp }}/diff.txt + comment-tag: csvdiff From 9ee806f90eea0965089e25f615338a0b8a684e4f Mon Sep 17 00:00:00 2001 From: Kaushik Malapati Date: Tue, 10 Dec 2024 00:31:36 -0800 Subject: [PATCH 11/15] Reversing diff ref order --- .github/workflows/daff.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/daff.yml b/.github/workflows/daff.yml index d0a2293..9fe317d 100644 --- a/.github/workflows/daff.yml +++ b/.github/workflows/daff.yml @@ -29,7 +29,7 @@ jobs: - name: make diff run: | daff git csv - git diff HEAD..origin/master > ${{ runner.temp }}/diff.txt + git diff origin/master..HEAD > ${{ runner.temp }}/diff.txt - name: make comment uses: thollander/actions-comment-pull-request@v3 with: From bbcf6cd5c02613e576d947387191cde17b7f2d78 Mon Sep 17 00:00:00 2001 From: Kaushik Malapati Date: Wed, 11 Dec 2024 16:40:16 -0800 Subject: [PATCH 12/15] checkout out source and adding target as remote, generating html --- .github/workflows/daff.yml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/daff.yml b/.github/workflows/daff.yml index 9fe317d..5f84921 100644 --- a/.github/workflows/daff.yml +++ b/.github/workflows/daff.yml @@ -1,4 +1,4 @@ -name: Generate Daff +name: Comment Diff on: pull_request_target: @@ -18,20 +18,27 @@ jobs: shell: bash --login -eo pipefail {0} permissions: pull-requests: write + steps: - uses: actions/checkout@v3 with: fetch-depth: 0 + ref: ${{ github.head_ref }} + - name: install requirements run: | pip install --upgrade pip pip install daff + - name: make diff run: | daff git csv - git diff origin/master..HEAD > ${{ runner.temp }}/diff.txt + 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 + - name: make comment uses: thollander/actions-comment-pull-request@v3 with: file-path: ${{ runner.temp }}/diff.txt - comment-tag: csvdiff From 982e738bdc895e18eed9a5a455ec904bde6eb676 Mon Sep 17 00:00:00 2001 From: Kaushik Malapati Date: Wed, 11 Dec 2024 16:45:39 -0800 Subject: [PATCH 13/15] reverting tmo csv --- Spreadsheet/KFE/TMO-alarms.csv | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Spreadsheet/KFE/TMO-alarms.csv b/Spreadsheet/KFE/TMO-alarms.csv index 3f45456..6119878 100644 --- a/Spreadsheet/KFE/TMO-alarms.csv +++ b/Spreadsheet/KFE/TMO-alarms.csv @@ -109,16 +109,16 @@ ,,pva://DAQ:NEH:tmo:0:Damage_bld,,,,, ,,pva://DAQ:NEH:tmo:0:Damage_epics,,,,, ,,pva://DAQ:NEH:tmo:0:Damage_atm,,,,, +1,SP1K4,,,,,, +,,SP1K4:PPM:CAM:TSS:SyncStatus,Camera Sync Status,,,SP1K4:PPM:CAM:TriggerMode_RBV!=0, +,,SP1K4:PPM:CAM:TSS:DiffVsIntAvg,Sync Diff,,,, 1,IM5K4,,,,,, -,,IM5K4:PPM:CAM:TSS:SyncStatus,Reversed Polarity Accidentally,,,IM5K4:PPM:CAM:TriggerMode_RBV==0, +,,IM5K4:PPM:CAM:TSS:SyncStatus,Camera Sync Status,,,IM5K4:PPM:CAM:TriggerMode_RBV!=0, ,,IM5K4:PPM:CAM:TSS:DiffVsIntAvg,Sync Diff,,,, 1,IM6K4,,,,,, ,,IM6K4:PPM:CAM:TSS:SyncStatus,Camera Sync Status,,,IM6K4:PPM:CAM:TriggerMode_RBV!=0, ,,IM6K4:PPM:CAM:TSS:DiffVsIntAvg,Sync Diff,,,, 0,TMO LASER,,,,,, -1,UADC,,,,,, +1,QADC,,,,,, ,,LM1K4:QADC:01:OUT0_EDGE1,QADC signal monitor,,,LM1K4:QADC:01:OUT0_EDGE1>0, ,,LM1K4:QADC:01:OUT0_EDGE2,QADC signal monitor,,,LM1K4:QADC:01:OUT0_EDGE2>0, -0,DAFF,,,,,, -1,New Row,,,,,, -,,LM1K4:QADC:01:OUT0_EDGE1,QADC signal monitor,,,LM1K4:QADC:01:OUT0_EDGE1>0, From 71674e7f20485c6e6ce04d463ecb9bed4e5145b4 Mon Sep 17 00:00:00 2001 From: Kaushik Malapati Date: Wed, 11 Dec 2024 16:54:46 -0800 Subject: [PATCH 14/15] readding comment tag --- .github/workflows/daff.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/daff.yml b/.github/workflows/daff.yml index 5f84921..061c855 100644 --- a/.github/workflows/daff.yml +++ b/.github/workflows/daff.yml @@ -42,3 +42,4 @@ jobs: uses: thollander/actions-comment-pull-request@v3 with: file-path: ${{ runner.temp }}/diff.txt + comment-tag: csvdiff \ No newline at end of file From a73c134d8feb0d41c8de3da79ef42264bedddf9a Mon Sep 17 00:00:00 2001 From: KaushikMalapati <80156796+KaushikMalapati@users.noreply.github.com> Date: Wed, 11 Dec 2024 17:46:00 -0800 Subject: [PATCH 15/15] Update .github/workflows/daff.yml Co-authored-by: Zachary Lentz --- .github/workflows/daff.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/daff.yml b/.github/workflows/daff.yml index 061c855..7089e17 100644 --- a/.github/workflows/daff.yml +++ b/.github/workflows/daff.yml @@ -20,7 +20,7 @@ jobs: pull-requests: write steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ github.head_ref }}