Skip to content

Commit

Permalink
Merge pull request #55 from tangkong/bld_daff_perms
Browse files Browse the repository at this point in the history
WIP/BLD: daff perms
  • Loading branch information
tangkong authored Dec 19, 2024
2 parents b3da97f + 1ccadc3 commit 87656e8
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 7 deletions.
13 changes: 7 additions & 6 deletions .github/workflows/daff.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Comment Diff

on:
pull_request_target:
pull_request:
paths:
- 'Spreadsheet/**'

Expand Down Expand Up @@ -37,10 +37,11 @@ jobs:
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
mkdir -p ./pr
git diff target/${{ github.event.pull_request.base.ref }}...HEAD Spreadsheet/ > pr/diff.txt
echo ${{ github.event.number }} > ./pr/NR
- name: make comment
uses: thollander/actions-comment-pull-request@v3
- uses: actions/upload-artifact@v4
with:
file-path: ${{ runner.temp }}/diff.txt
comment-tag: csvdiff
name: diff
path: pr/
51 changes: 51 additions & 0 deletions .github/workflows/makecomment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Comment on the pull request
on:
workflow_run:
workflows: ["Comment Diff"]
types:
- completed

jobs:
upload:
runs-on: ubuntu-latest
if: >
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'success'
steps:
- name: 'Download artifact'
uses: actions/github-script@v7
with:
script: |
var artifacts = await github.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{ github.event.workflow_run.id }},
});
var matchArtifact = artifacts.data.artifacts.filter((artifact) => {
return artifact.name == "diff"
})[0];
var download = await github.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
});
var fs = require('fs');
fs.writeFileSync('${{ github.workspace }}/pr.zip', Buffer.from(download.data));
- run: unzip pr.zip

- name: 'Comment on PR'
uses: actions/github-script@v7
with:
github-token: ${{ secrets.COMMENT_TOKEN }}
script: |
var fs = require('fs');
var issue_number = Number(fs.readFileSync('./NR'));
var diff_text = String(fs.readFileSync('./diff.txt'));
await github.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue_number,
body: diff_text
});
1 change: 0 additions & 1 deletion Spreadsheet/KFE/QRIX-alarms.csv
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
#Indent,Branch,PV,Description,Latch,Delay,Filter,Guidance
0,QRIX,,,,,,
,,MR1K1:BEND:RTD:US:1_RBV,TEMPERATURE,,,,

0 comments on commit 87656e8

Please sign in to comment.