diff --git a/.github/workflows/weekly-stable-updates.yml b/.github/workflows/weekly-stable-updates.yml index 7a8c3eb16..379100560 100644 --- a/.github/workflows/weekly-stable-updates.yml +++ b/.github/workflows/weekly-stable-updates.yml @@ -1,9 +1,12 @@ name: "Weekly Stable Updates" +permissions: + issues: write + on: - #schedule: + schedule: # Run every Monday at 9:00 AM UTC - # - cron: '0 9 * * 1' + - cron: '0 9 * * 1' workflow_dispatch: # Allow manual triggering for testing jobs: @@ -16,6 +19,7 @@ jobs: run: echo "date=$(date +'%Y%m%d')" >> $GITHUB_OUTPUT - name: Create weekly stable updates issue + id: create-issue uses: actions/github-script@v7 with: github-token: ${{ secrets.GITHUB_TOKEN }} @@ -39,12 +43,31 @@ jobs: And put the contents from this command in the PR description and commit messages.`; + // Check for existing issues with the same title + const existingIssues = await github.rest.issues.listForRepo({ + owner: context.repo.owner, + repo: context.repo.repo, + state: 'open', + per_page: 100 + }); + const duplicateIssue = existingIssues.data.find(issue => /^Stable Updates \d{8}$/.test(issue.title)); + if (duplicateIssue) { + console.log(`Issue with title "${duplicateIssue.title}" already exists: #${duplicateIssue.number}`); + return; + } + const response = await github.rest.issues.create({ owner: context.repo.owner, repo: context.repo.repo, title: title, body: body, - assignees: ['copilot-swe-agent'] }); console.log(`Created issue #${response.data.number}: ${response.data.title}`); + core.setOutput('issue-number', response.data.number); + + - name: Add assignee to issue + if: steps.create-issue.outputs.issue-number && steps.create-issue.outputs.issue-number != '' + run: gh issue edit ${{ steps.create-issue.outputs.issue-number }} --add-assignee "@copilot" -R dotnet/android-libraries + env: + GH_TOKEN: ${{ secrets.ANDROID_TEAM_PAT }}