Debian Codegraph @

.github/workflows/ci-python3-dependencies.yml

raw symbols SCIP
1 # This is a basic workflow to help you get started with Actions
2
3 name: CI python3 Dependencies
4
5 # Controls when the action will run. Triggers the workflow on push or pull request
6 # events but only for the master branch
7 on:
8 workflow_dispatch:
9 schedule:
10 - cron: '37 15 * * 5'
11
12 permissions:
13 issues: write
14
15 # A workflow run is made up of one or more jobs that can run sequentially or in parallel
16 jobs:
17 # This workflow contains a single job called "build"
18 test:
19 # The type of runner that the job will run on
20 runs-on: ubuntu-latest
21
22 # Steps represent a sequence of tasks that will be executed as part of the job
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')