Skip to content

s

s #23

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: ubuntu-latest
permissions:
issues: write
env:
REPORT_ID: "id:outdated-packages"
WORKING_DIR: "botframework-sdk"
steps:
- uses: actions/checkout@v2
- name: use node 22.x
uses: actions/setup-node@v4
with:
node-version: 22.x
- name: check existing issue
run: |
$json = 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 "Existing issue #$($json.number) found. Exiting..."
return;
}
$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_NUMBER=$($json.number)" >> "$GITHUB_OUTPUT"
echo "ISSUE_HASH=$hash" >> "$GITHUB_OUTPUT"
shell: pwsh
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 report.ts | ConvertFrom-Json
if($json.integrity -eq $env:ISSUE_HASH) {
echo "No changes detected. Exiting..."
exit 0;
}
"<!--
${{ env.REPORT_ID }}
hash:$($json.integrity)
-->
$($json.markdown)" | Out-File report.md
shell: pwsh
working-directory: ${{ WORKING_DIR }}

Check failure on line 69 in .github/workflows/create-outdated-packages-issue.yml

View workflow run for this annotation

GitHub Actions / Outdated Packages

Invalid workflow file

The workflow is not valid. .github/workflows/create-outdated-packages-issue.yml (Line: 69, Col: 28): Unrecognized named-value: 'WORKING_DIR'. Located at position 1 within expression: WORKING_DIR .github/workflows/create-outdated-packages-issue.yml (Line: 83, Col: 28): Unrecognized named-value: 'WORKING_DIR'. Located at position 1 within expression: WORKING_DIR
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 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: pwsh
working-directory: ${{ WORKING_DIR }}
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 }}