Repository navigation
69 lines (60 loc) · 2.49 KB
/
Copy pathpython-floor.yml
File metadata and controls
69 lines (60 loc) · 2.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# Automation Scripts - Python Floor Currency
# Windows-native (PowerShell) weekly check of the Python floor declared in
# quality.yml against the upstream EOL calendar. A bump is applied and pushed
# to both hosts without human intervention. GitLab uses the repository's
# existing GITLAB_PUSH_TOKEN secret (write_repository scope).
name: Python Floor Currency
on:
schedule:
- cron: "0 8 * * 1"
workflow_dispatch:
concurrency:
group: python-floor
cancel-in-progress: false
permissions:
contents: write
jobs:
floor:
name: Check and bump floor
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
- name: Compare declared floor with upstream EOL calendar
id: check
shell: pwsh
run: ./Tools/Check-PythonFloor.ps1 -Check
- name: Apply floor bump
if: steps.check.outputs.changed == 'true'
shell: pwsh
env:
DESIRED: ${{ steps.check.outputs.desired }}
run: ./Tools/Check-PythonFloor.ps1 -Apply -Version $env:DESIRED
- name: Verify parity after bump
if: steps.check.outputs.changed == 'true'
shell: pwsh
run: ./Tools/Check-PythonFloor.ps1 -Check
- name: Commit and push to both hosts
if: steps.check.outputs.changed == 'true'
shell: pwsh
env:
DESIRED: ${{ steps.check.outputs.desired }}
GITLAB_TOKEN: ${{ secrets.GITLAB_PUSH_TOKEN }}
run: |
$ErrorActionPreference = 'Stop'
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add .github/workflows/quality.yml Docs/Overview-And-Setup.md
if (git diff --cached --quiet) { throw "Floor bump produced no changes" }
git commit -m "chore: bump Python floor to $env:DESIRED"
git push origin HEAD:main
git remote add gitlab https://gitlab.com/bayraktarozcan/Maintenance-Scripts.git 2>$null
if ($env:GITLAB_TOKEN) {
$askpass = Join-Path $env:RUNNER_TEMP 'gitlab-askpass.sh'
Set-Content -LiteralPath $askpass -Value '#!/bin/sh' -Encoding ascii
Add-Content -LiteralPath $askpass -Value 'case "$1" in *Username*) echo oauth2 ;; *) printf "%s\n" "$GITLAB_TOKEN" ;; esac' -Encoding ascii
chmod +x $askpass
$env:GIT_ASKPASS = $askpass
git push gitlab HEAD:main
} else {
Write-Host "GITLAB_PUSH_TOKEN is not configured; GitLab push skipped."
}