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: Outdated Packages | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| - 'joelmut/test/package-notification' | |
| # schedule: | |
| # # Daily at 8:20 UTC | |
| # - cron: '20 8 * * *' | |
| # TODO: for testing use a manual execution. | |
| jobs: | |
| issue: | |
| runs-on: windows-latest | |
| permissions: | |
| issues: write | |
| env: | |
| REPORT_ID: "id:outdated-packages" | |
| WORKING_DIR: "botframework-sdk" | |
| steps: | |
| - name: use node 22.x | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22.x | |
| - name: check existing issue | |
| run: | | |
| $json = Invoke-Expression "gh issue list --search `"in:body *${{ env.REPORT_ID }}*`" --repo $GITHUB_REPOSITORY --app github-actions --state open --json id,number,body" | ConvertFrom-Json | |
| if($json.body -eq $null) { | |
| echo "ISSUE_NUMBER=$($json.number)" >> "$GITHUB_OUTPUT" | |
| exit 0 | |
| } | |
| $start = $json.body.IndexOf("<!--"); | |
| $end = $json.body.IndexOf("-->") + 3; | |
| $header = $json.body.Substring($start, $end - $start) | |
| $hash = $header.Split("hash:")[1].Split("`n")[0].Trim(); | |
| echo "ISSUE_HASH=$hash" >> "$GITHUB_OUTPUT" | |
| shell: powershell | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| # - name: get script from botframework-sdk | |
| # run: | | |
| # wget <botframework-sdk repo> | |
| # working-directory: ${{ WORKING_DIR }} | |
| - name: generate report | |
| run: | | |
| $json = node --experimental-transform-types ./botframework-sdk/report.ts | ConvertFrom-Json | |
| if($json.integrity -eq $env:ISSUE_HASH) { | |
| echo "No changes detected. Exiting..." | |
| exit 0 | |
| } | |
| "<!-- | |
| ${REPORT_ID} | |
| hash:$($json.integrity) | |
| --> | |
| $($json.markdown)" | Out-File ./botframework-sdk/report.md | |
| Get-Content ./botframework-sdk/report.md | |
| shell: powershell | |
| env: | |
| ISSUE_HASH: ${{ steps.check-existing-issue.outputs.ISSUE_HASH }} | |
| - name: create/update issue | |
| if: ${{ steps.check-existing-issue.outputs.ISSUE_HASH != '' }} | |
| run: | | |
| $content = Get-Content ./botframework-sdk/report.md; | |
| if($env:ISSUE_NUMBER -eq '') { | |
| gh issue create --title "Outdated packages" --body $content --repo $GITHUB_REPOSITORY; | |
| } else { | |
| gh issue edit $env:ISSUE_NUMBER --body $content --repo $GITHUB_REPOSITORY; | |
| } | |
| shell: powershell | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| ISSUE: ${{ github.event.issue.html_url }} | |
| ISSUE_NUMBER: ${{ steps.check-existing-issue.outputs.ISSUE_NUMBER }} | |
| ISSUE_HASH: ${{ steps.check-existing-issue.outputs.ISSUE_HASH }} | |
| # https://cli.github.com/manual/gh_issue_create | |
| # - run: | | |
| # gh issue create --title "Issue report" --body "$NUM_OPEN_ISSUES issues remaining" --repo $GITHUB_REPOSITORY | |
| # env: | |
| # GH_TOKEN: ${{ github.token }} | |
| # ISSUE: ${{ github.event.issue.html_url }} | |
| # Get outdated packages | |
| # Generate hash | |
| # Check if existing issue is open by checking the cache || title || body.hash, and save a boolean flag | |
| # If the issue exists, compare hash with the "Get outdated packages" step | |
| # If the hash is the same, exit | |
| # Generate .md report | |
| # if boolean flag is true, update the issue with the new report | |
| # if boolean flag is false, create a new issue with the report | |
| # - run: | | |
| # https://cli.github.com/manual/gh_issue_create | |
| # gh issue create --title "Issue report" --body "$NUM_OPEN_ISSUES issues remaining" --repo $GITHUB_REPOSITORY | |
| # env: | |
| # GH_TOKEN: ${{ github.token }} | |
| # ISSUE: ${{ github.event.issue.html_url }} |