| 1 |
|
| 2 |
|
| 3 |
name: CI python3 Dependencies |
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
on: |
| 8 |
workflow_dispatch: |
| 9 |
schedule: |
| 10 |
- cron: '37 15 * * 5' |
| 11 |
|
| 12 |
permissions: |
| 13 |
issues: write |
| 14 |
|
| 15 |
|
| 16 |
jobs: |
| 17 |
|
| 18 |
test: |
| 19 |
|
| 20 |
runs-on: ubuntu-latest |
| 21 |
|
| 22 |
|
| 23 |
steps: |
| 24 |
- name: Create GitHub issue if new Python minor version is available |
| 25 |
uses: actions/github-script@v7 |
| 26 |
with: |
| 27 |
script: | |
| 28 |
// Get latest Python minor version |
| 29 |
const pythonVersions = await fetch('https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json') |
| 30 |
.then(response => response.json()) |
| 31 |
.then(data => data.map(pythonVersion => pythonVersion.version)) |
| 32 |
.then(pythonVersions => pythonVersions.sort((a, b) => b.localeCompare(a, undefined, { numeric: true }))) |
| 33 |
const latestPythonMinorVersion = pythonVersions[0].split('.').slice(0, 2).join('.') |
| 34 |
|
| 35 |
// Check if new Python minor version exists |
| 36 |
if (latestPythonMinorVersion === '3.15') { |
| 37 |
return |
| 38 |
} |
| 39 |
|
| 40 |
console.log('New Python minor version detected: ' + latestPythonMinorVersion) |
| 41 |
|
| 42 |
// Check if Github issue already exists |
| 43 |
const issueTitle = 'Add support for Python ' + latestPythonMinorVersion |
| 44 |
const issues = await github.paginate(github.rest.issues.listForRepo, { |
| 45 |
owner: context.repo.owner, |
| 46 |
repo: context.repo.repo, |
| 47 |
state: 'open', |
| 48 |
}) |
| 49 |
const existingIssue = issues.find(issue => issue.title === issueTitle) |
| 50 |
if (existingIssue) { |
| 51 |
console.log('Issue already exists') |
| 52 |
return |
| 53 |
} |
| 54 |
|
| 55 |
// Create new Github issue |
| 56 |
github.rest.issues.create({ |
| 57 |
owner: context.repo.owner, |
| 58 |
repo: context.repo.repo, |
| 59 |
title: issueTitle, |
| 60 |
}) |
| 61 |
console.log('New Github issue created') |