Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions .github/workflows/versioning.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Workflow that runs on versioning metadata updates.
# Uses GITHUB_TOKEN (not a personal PAT) for same-repo operations.
# Cross-repo API updates require POLICYENGINE_GITHUB secret (org-level PAT).

name: Versioning updates
on:
Expand All @@ -11,16 +13,20 @@ on:
- pyproject.toml
workflow_dispatch:

permissions:
contents: write

jobs:
Versioning:
runs-on: ubuntu-latest
if: |
(!(github.event.head_commit.message == 'Update package version'))
outputs:
committed: ${{ steps.commit.outputs.committed }}
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
token: ${{ secrets.POLICYENGINE_GITHUB }}
fetch-depth: 0
- name: Install uv
uses: astral-sh/setup-uv@v5
Expand All @@ -35,18 +41,20 @@ jobs:
python .github/bump_version.py
towncrier build --yes --version $(python -c "import re; print(re.search(r'version = \"(.+?)\"', open('pyproject.toml').read()).group(1))")
- name: Update changelog
id: commit
uses: EndBug/add-and-commit@v9
with:
add: "."
message: Update package version
Publish:
runs-on: ubuntu-latest
if: (github.event.head_commit.message == 'Update package version')
env:
GH_TOKEN: ${{ secrets.POLICYENGINE_GITHUB }}
needs: Versioning
if: needs.Versioning.outputs.committed == 'true'
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
ref: main
- name: Install uv
uses: astral-sh/setup-uv@v5

Expand All @@ -71,6 +79,7 @@ jobs:
password: ${{ secrets.PYPI }}
skip_existing: true
- name: Update API
if: ${{ secrets.POLICYENGINE_GITHUB != '' }}
run: python .github/update_api.py
env:
GITHUB_TOKEN: ${{ secrets.POLICYENGINE_GITHUB }}
GITHUB_TOKEN: ${{ secrets.POLICYENGINE_GITHUB }}
1 change: 1 addition & 0 deletions changelog.d/fix-versioning-workflow.changed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Replaced personal PAT with `GITHUB_TOKEN` in versioning workflow. Publish now runs as a sequential job instead of requiring a re-triggered workflow, removing the dependency on a personal access token for same-repo operations.
Loading