Skip to content

CI python3 Dependencies #20

CI python3 Dependencies

CI python3 Dependencies #20

# This is a basic workflow to help you get started with Actions
name: CI python3 Dependencies
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
workflow_dispatch:
schedule:
- cron: '37 15 * * 5'
permissions:
issues: write
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
test:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Create GitHub issue if new Python minor version is available
uses: actions/github-script@v7
with:
script: |
// Get latest Python minor version
const pythonVersions = await fetch('https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json')
.then(response => response.json())
.then(data => data.map(pythonVersion => pythonVersion.version))
.then(pythonVersions => pythonVersions.sort((a, b) => b.localeCompare(a, undefined, { numeric: true })))
const latestPythonMinorVersion = pythonVersions[0].split('.').slice(0, 2).join('.')
// Check if new Python minor version exists
if (latestPythonMinorVersion === '3.14') {
return
}
console.log('New Python minor version detected: ' + latestPythonMinorVersion)
// Check if Github issue already exists
const issueTitle = 'Add support for Python ' + latestPythonMinorVersion
const issues = await github.paginate(github.rest.issues.listForRepo, {
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open',
})
const existingIssue = issues.find(issue => issue.title === issueTitle)
if (existingIssue) {
console.log('Issue already exists')
return
}
// Create new Github issue
github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: issueTitle,
})
console.log('New Github issue created')