Skip to content

Commit e0e228f

Browse files
Add example workflow and enhance action metadata for CPython Patch PR Action
1 parent 7604773 commit e0e228f

File tree

4 files changed

+92
-8
lines changed

4 files changed

+92
-8
lines changed

.github/workflows/example.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Example Usage
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
run-action:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v4
11+
- name: Run CPython Patch PR Action
12+
uses: ./
13+
with:
14+
track: '3.13'
15+
include_prerelease: false
16+
paths: |
17+
.github/workflows/**/*.yml
18+
Dockerfile
19+
pyproject.toml
20+
automerge: false
21+
dry_run: true

action.yml

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,40 @@
11
name: CPython Patch PR Action
2-
description: "Scaffolded placeholder for the CPython patch PR GitHub Action."
2+
description: Track CPython patch releases and prepare update pull requests.
33
author: Casper Kristiansson
4+
inputs:
5+
track:
6+
description: CPython minor series to track (for example 3.13).
7+
required: false
8+
default: "3.13"
9+
include_prerelease:
10+
description: Include pre-release tags when resolving the latest patch version.
11+
required: false
12+
default: "false"
13+
paths:
14+
description: Newline-separated glob patterns that determine which files to scan for pinned Python versions.
15+
required: false
16+
default: |
17+
.github/workflows/**/*.yml
18+
Dockerfile
19+
**/Dockerfile
20+
**/*.python-version
21+
**/runtime.txt
22+
**/pyproject.toml
23+
automerge:
24+
description: Attempt to automerge the pull request after required checks succeed.
25+
required: false
26+
default: "false"
27+
dry_run:
28+
description: Skip file modifications and output the planned changes only.
29+
required: false
30+
default: "false"
31+
outputs:
32+
new_version:
33+
description: Resolved CPython patch version (for example 3.13.5).
34+
files_changed:
35+
description: JSON array listing files that were updated.
36+
skipped_reason:
37+
description: Machine-readable reason describing why no update was applied.
438
runs:
539
using: node20
640
main: dist/index.js
7-
defaults:
8-
run:
9-
shell: bash

docs/tasks.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ Use Context7 MCP for up to date documentation.
7474
Files: `package.json`, `tsconfig.json`, `action.yml`, `src/index.ts`.
7575
Verify: `npm run build` succeeds. `node dist/index.js` prints placeholder.
7676

77-
3. [ ] **Define action metadata**
77+
3. [x] **Define action metadata**
7878
Inputs: `track`, `include_prerelease`, `paths`, `automerge`, `dry_run`.
7979
Outputs: `new_version`, `files_changed`, `skipped_reason`. `runs: node20`.
8080
Verify: `actionlint` passes on sample workflow.

src/index.ts

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,41 @@ import * as core from '@actions/core';
33
async function run(): Promise<void> {
44
try {
55
const track = core.getInput('track') || '3.13';
6-
core.info(`CPython Patch PR Action placeholder executing for track ${track}.`);
7-
// Temporary placeholder output until task-specific logic is implemented.
8-
console.log('Placeholder: CPython patch PR action is under construction.');
6+
const includePrerelease =
7+
core.getInput('include_prerelease').toLowerCase() === 'true';
8+
const paths =
9+
core
10+
.getMultilineInput('paths', { trimWhitespace: true })
11+
.filter(Boolean) || [];
12+
const automerge = core.getInput('automerge').toLowerCase() === 'true';
13+
const dryRun = core.getInput('dry_run').toLowerCase() === 'true';
14+
15+
const effectivePaths =
16+
paths.length > 0
17+
? paths
18+
: [
19+
'.github/workflows/**/*.yml',
20+
'**/Dockerfile',
21+
'**/.python-version',
22+
'**/runtime.txt',
23+
'**/pyproject.toml'
24+
];
25+
26+
core.startGroup('Configuration');
27+
core.info(`track: ${track}`);
28+
core.info(`include_prerelease: ${includePrerelease}`);
29+
core.info(
30+
`paths (${effectivePaths.length}): ${effectivePaths.join(', ')}`
31+
);
32+
core.info(`automerge: ${automerge}`);
33+
core.info(`dry_run: ${dryRun}`);
34+
core.endGroup();
35+
36+
// Placeholder output until the implementation is completed in later tasks.
37+
core.info('CPython Patch PR Action placeholder executing.');
38+
core.setOutput('new_version', '');
39+
core.setOutput('files_changed', JSON.stringify([]));
40+
core.setOutput('skipped_reason', 'not_implemented');
941
} catch (error) {
1042
if (error instanceof Error) {
1143
core.setFailed(error.message);

0 commit comments

Comments
 (0)