@@ -27,21 +27,21 @@ jobs:
2727 with :
2828 node-version : 22.x
2929
30- # https://cli.github.com/manual/gh_issue_create
31- # - run: |
32- # gh issue create --title "Issue report" --body "$NUM_OPEN_ISSUES issues remaining" --repo $GITHUB_REPOSITORY
33- # env:
34- # GH_TOKEN: ${{ github.token }}
35- # ISSUE: ${{ github.event.issue.html_url }}
36-
3730 - name : check existing issue
38- # use --author github-actions and improve --search
39- # shell: pwsh
4031 run : |
41- gh issue list --search "\"${{ env.REPORT_ID }}\" in:body" --repo $GITHUB_REPOSITORY
32+ $json = gh issue list --search "in:body *${{ env.REPORT_ID }}*" --repo $GITHUB_REPOSITORY --app github-actions --state open --json id,number,body | ConvertFrom-Json
33+ if($json.body -eq $null) {
34+ echo "ISSUE_NUMBER=$($json.number)" >> "$GITHUB_OUTPUT"
35+ exit 0
36+ }
37+ $start = $json.body.IndexOf("<!--");
38+ $end = $json.body.IndexOf("-->") + 3;
39+ $header = $json.body.Substring($start, $end - $start)
40+ $hash = $header.Split("hash:")[1].Split("`n")[0].Trim();
41+ echo "ISSUE_HASH=$hash" >> "$GITHUB_OUTPUT"
42+ shell : pwsh
4243 env :
4344 GH_TOKEN : ${{ github.token }}
44- # ISSUE: ${{ github.event.issue.html_url }}
4545
4646 # - name: get script from botframework-sdk
4747 # run: |
@@ -50,22 +50,47 @@ jobs:
5050
5151 - name : generate report
5252 run : |
53- json = node --experimental-transform-types report.ts | jq --slurp
54- `
55- <!--
53+ $json = node --experimental-transform-types report.ts | ConvertFrom-Json
54+ if($json.integrity -eq $env:ISSUE_HASH) {
55+ echo "No changes detected. Exiting..."
56+ exit 0
57+ }
58+
59+ "<!--
5660 ${REPORT_ID}
57- hash:${ json.integrity}
61+ hash:$($ json.integrity)
5862 -->
5963
60- ${ json.markdown}
61- ` > report.md
62- cat report.md
64+ $($ json.markdown)" | Out-File report.md
65+ Get-Content report.md
66+ shell : pwsh
6367 working-directory : botframework-sdk
68+ env :
69+ ISSUE_HASH : ${{ steps.check-existing-issue.outputs.ISSUE_HASH }}
6470
65- # - name: update report
66- # run: |
67- # checksum = cat ./botframework-sdk/.checksum
68- # report = cat ./botframework-sdk/report.md
71+ - name : " ${{ steps.check-existing-issue.outputs.ISSUE_NUMBER != '' ? 'update' : 'create' }} issue"
72+ if : ${{ steps.check-existing-issue.outputs.ISSUE_HASH != '' }}
73+ run : |
74+ $content = Get-Content report.md;
75+ if($env:ISSUE_NUMBER -eq '') {
76+ gh issue create --title "Outdated packages" --body $content --repo $GITHUB_REPOSITORY;
77+ } else {
78+ gh issue edit $env:ISSUE_NUMBER --body $content --repo $GITHUB_REPOSITORY;
79+ }
80+ shell : pwsh
81+ working-directory : botframework-sdk
82+ env :
83+ GH_TOKEN : ${{ github.token }}
84+ ISSUE : ${{ github.event.issue.html_url }}
85+ ISSUE_NUMBER : ${{ steps.check-existing-issue.outputs.ISSUE_NUMBER }}
86+ ISSUE_HASH : ${{ steps.check-existing-issue.outputs.ISSUE_HASH }}
87+
88+ # https://cli.github.com/manual/gh_issue_create
89+ # - run: |
90+ # gh issue create --title "Issue report" --body "$NUM_OPEN_ISSUES issues remaining" --repo $GITHUB_REPOSITORY
91+ # env:
92+ # GH_TOKEN: ${{ github.token }}
93+ # ISSUE: ${{ github.event.issue.html_url }}
6994
7095 # Get outdated packages
7196 # Generate hash
0 commit comments