Skip to content

Commit 0a8b585

Browse files
feat: update default branch detection and versioning in workflows
1 parent 4f3c54a commit 0a8b585

File tree

6 files changed

+14
-7
lines changed

6 files changed

+14
-7
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ The project follows [Semantic Versioning](https://semver.org/) and adheres to th
1313
### Fixed
1414

1515
- Allow default runs to create pull requests again instead of always behaving like a dry-run.
16+
- Detect the default branch correctly even when `GITHUB_BASE_REF` is present but empty in scheduled workflows.
1617

1718
## [1.1.0] - 2025-10-10
1819

SECURITY.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ vulnerabilities responsibly.
66

77
## Supported versions
88

9-
Only the latest released version (the `v0` tag during the pre-1.0 cycle) receives
9+
Only the latest released version (the `v1` tag) receives
1010
security updates. Please upgrade to the newest minor release before opening security
1111
reports.
1212

@@ -45,7 +45,7 @@ private forks or cross-organization repositories.
4545

4646
If we confirm a critical vulnerability, we will:
4747

48-
1. Publish a fixed release and update the `v0` tag.
48+
1. Publish a fixed release and update the `v1` tag.
4949
2. Document the risk, affected versions, and mitigation steps in the changelog.
5050
3. Notify followers through the repository Security Advisory system when available.
5151

dist/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80933,9 +80933,11 @@ async function run() {
8093380933
const effectivePaths = resolvePathsInput();
8093480934
const securityKeywords = resolveSecurityKeywords();
8093580935
const workspace = node_process_1.default.env.GITHUB_WORKSPACE ?? node_process_1.default.cwd();
80936+
const baseRefEnv = (node_process_1.default.env.GITHUB_BASE_REF ?? '').trim();
80937+
const refNameEnv = (node_process_1.default.env.GITHUB_REF_NAME ?? '').trim();
80938+
const defaultBranch = baseRefEnv || refNameEnv || 'main';
8093680939
const repository = parseRepository(node_process_1.default.env.GITHUB_REPOSITORY);
8093780940
const githubToken = node_process_1.default.env.GITHUB_TOKEN;
80938-
const defaultBranch = node_process_1.default.env.GITHUB_BASE_REF ?? node_process_1.default.env.GITHUB_REF_NAME ?? 'main';
8093980941
const noNetworkFallback = (node_process_1.default.env.NO_NETWORK_FALLBACK ?? '').toLowerCase() === 'true';
8094080942
let cpythonTagsSnapshot;
8094180943
let pythonOrgHtmlSnapshot;
@@ -80984,6 +80986,7 @@ async function run() {
8098480986
core.info(`use_external_pr_action: ${useExternalPrAction}`);
8098580987
core.info(`dry_run: ${dryRun}`);
8098680988
core.info(`no_network_fallback: ${noNetworkFallback}`);
80989+
core.info(`default_branch: ${defaultBranch}`);
8098780990
if (repository) {
8098880991
core.info(`repository: ${repository.owner}/${repository.repo}`);
8098980992
}

examples/guarded/.github/workflows/python-version-patch.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828

2929
- name: Preview CPython patch diff
3030
id: preview
31-
uses: casperkristiansson/python-version-patch-pr@v0
31+
uses: casperkristiansson/python-version-patch-pr@v1
3232
with:
3333
track: ${{ env.TRACK }}
3434
dry_run: true
@@ -93,7 +93,7 @@ else:
9393
PY
9494

9595
- name: Apply CPython patch update
96-
uses: casperkristiansson/python-version-patch-pr@v0
96+
uses: casperkristiansson/python-version-patch-pr@v1
9797
with:
9898
track: ${{ env.TRACK }}
9999
automerge: false

examples/minimal/.github/workflows/python-version-patch.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
uses: actions/checkout@v4
1717

1818
- name: Update CPython patch versions
19-
uses: casperkristiansson/python-version-patch-pr@v0
19+
uses: casperkristiansson/python-version-patch-pr@v1
2020
with:
2121
track: '3.12'
2222
env:

src/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,9 +226,11 @@ export async function run(): Promise<void> {
226226
const securityKeywords = resolveSecurityKeywords();
227227

228228
const workspace = process.env.GITHUB_WORKSPACE ?? process.cwd();
229+
const baseRefEnv = (process.env.GITHUB_BASE_REF ?? '').trim();
230+
const refNameEnv = (process.env.GITHUB_REF_NAME ?? '').trim();
231+
const defaultBranch = baseRefEnv || refNameEnv || 'main';
229232
const repository = parseRepository(process.env.GITHUB_REPOSITORY);
230233
const githubToken = process.env.GITHUB_TOKEN;
231-
const defaultBranch = process.env.GITHUB_BASE_REF ?? process.env.GITHUB_REF_NAME ?? 'main';
232234
const noNetworkFallback = (process.env.NO_NETWORK_FALLBACK ?? '').toLowerCase() === 'true';
233235

234236
let cpythonTagsSnapshot: StableTag[] | undefined;
@@ -286,6 +288,7 @@ export async function run(): Promise<void> {
286288
core.info(`use_external_pr_action: ${useExternalPrAction}`);
287289
core.info(`dry_run: ${dryRun}`);
288290
core.info(`no_network_fallback: ${noNetworkFallback}`);
291+
core.info(`default_branch: ${defaultBranch}`);
289292
if (repository) {
290293
core.info(`repository: ${repository.owner}/${repository.repo}`);
291294
}

0 commit comments

Comments
 (0)