Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
a83d4b5
Add test for matrix generation
chris11-taylor-nttd Aug 4, 2025
f39b998
Reverse .tool-versions order
chris11-taylor-nttd Aug 4, 2025
b31eb49
Drop git requirement from .tool-versions
chris11-taylor-nttd Aug 4, 2025
a09f5c2
Drop git requirement from .tool-versions
chris11-taylor-nttd Aug 4, 2025
2f90d03
Sleep on failure so I can try to see what's going on
chris11-taylor-nttd Aug 4, 2025
1e2e029
Use head_ref
chris11-taylor-nttd Aug 4, 2025
f66c73b
Add automated test for PR labeling
chris11-taylor-nttd Aug 6, 2025
6b429c9
Fix escape characters in release-drafter configuration
chris11-taylor-nttd Aug 6, 2025
19cf8d9
Sleep to give the main branch time to be created
chris11-taylor-nttd Aug 6, 2025
0998388
Debugging race?
chris11-taylor-nttd Aug 6, 2025
14970da
Merge branch 'main' into feature/automated-tests
chris11-taylor-nttd Aug 6, 2025
fd7e1de
Fixture should provide better repo description
chris11-taylor-nttd Aug 6, 2025
e573311
Get main branch sha once
chris11-taylor-nttd Aug 6, 2025
f044c71
Fixture consolidation
chris11-taylor-nttd Aug 6, 2025
3b5e726
Cleanup PR naming
chris11-taylor-nttd Aug 7, 2025
808fd7d
Merge branch 'main' into feature/automated-tests
chris11-taylor-nttd Feb 9, 2026
6fbd8a9
wip: nttdtest
chris11-taylor-nttd Feb 9, 2026
639bcee
wip: testing fix for pr label
chris11-taylor-nttd Feb 9, 2026
6353fec
drop case after fixing workflow
chris11-taylor-nttd Feb 9, 2026
7f69e32
drop stray pycache files
chris11-taylor-nttd Feb 9, 2026
b9de373
clean up __pycache__
chris11-taylor-nttd Feb 9, 2026
88c00a9
clean up test lib
chris11-taylor-nttd Feb 9, 2026
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
6 changes: 3 additions & 3 deletions .github/workflows/reusable-pr-label-by-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
jq -e 'if map(select(.name | contains ("major"))) == [] then null else "Label major exists" end' labels.json || gh label create major --color "b60205"
label-pr:
name: Label Pull Request
needs: [ configure-labels ]
needs: [configure-labels]
permissions:
contents: read
pull-requests: write
Expand Down Expand Up @@ -50,7 +50,7 @@ jobs:
echo "updates_configuration=false" >> $GITHUB_OUTPUT
fi
if [[ $PR_NUMBER -eq "1" ]]; then
if git cat-file -e ${{ github.event.repository.default_branch }}:.github/release-drafter.yml 2>/dev/null; then
if git cat-file -e origin/${{ github.event.repository.default_branch }}:.github/release-drafter.yml 2>/dev/null; then
# First PR, but we have a release-drafter.yml file on the main branch so we can let it proceed as normal.
echo "auto_label=true" >> $GITHUB_OUTPUT
else
Expand All @@ -63,7 +63,7 @@ jobs:
# Not the first PR, so we can attempt to auto-label it.
echo "auto_label=true" >> $GITHUB_OUTPUT
fi

rm first-time-comment.md
- uses: release-drafter/release-drafter@6db134d15f3909ccc9eefd369f02bd1e9cffdf97
if: steps.prerequisite-check.outputs.auto_label == 'true'
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/reusable-release-on-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@ on:
description: 'Whether to disable the autolabeler. Autolabeler should remain disabled if you label the pull requests with another workflow. Default: true'
required: false
default: true
run_post_release_workflow:
type: boolean
description: 'Trigger a post-release workflow at .github/workflows/release-post-actions.yml within your repository that receives a "version" input with the version that was just released. This workflow can do whatever you need, but generally is used to e.g. release a package to a package regsitry. Default: false'
required: false
default: false
outputs:
release_version:
description: 'The version of the release that was created by this workflow. This is the tag name of the release.'
Expand Down
57 changes: 57 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Run Tests

on:
pull_request:
types: [opened, reopened, synchronize]

permissions:
contents: read
checks: write
pull-requests: write

jobs:
build:
name: Run Tests
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ "3.13" ]
steps:
- uses: actions/checkout@8edcb1bdb4e267140fa742c62e395cd74f332709

- name: Restore cached asdf tools
uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684
id: cache
with:
path: ~/.asdf
key: ${{ runner.os }}-tool-versions-${{ hashFiles('.tool-versions') }}

- name: asdf install
uses: asdf-vm/actions/install@1902764435ca0dd2f3388eea723a4f92a4eb8302

- name: Cache asdf tools
uses: actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684
id: save-cache
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
with:
path: ~/.asdf
key: ${{ runner.os }}-tool-versions-${{ hashFiles('.tool-versions') }}

- name: Set up Python ${{ matrix.python-version }}
uses: astral-sh/setup-uv@e92bafb6253dcd438e0484186d7669ea7a8ca1cc
with:
python-version: ${{ matrix.python-version }}

- uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e
id: app-token
with:
app-id: ${{ vars.APP_ID }}
owner: ${{ vars.APP_OWNER }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}

- name: Test with pytest
env:
LAUNCH_WORKFLOWS_REF_TO_TEST: ${{ github.head_ref }}
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
run: |
uv run pytest
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.pytest_cache
__pycache__
*.py[cod]
.venv
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
uv 0.8.4
13 changes: 13 additions & 0 deletions docs/reusable-release-draft-on-merge.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,16 @@ jobs:
```

Be sure you replace `ref` with an appropriate ref to this repository.

If this workflow runs in a repository without a prior Release being published, the first release will always be drafted with version 0.1.0. This is expected behavior and conforms to the SemVer spec, which permits a major version zero. From the SemVer documentation:

> How should I deal with revisions in the 0.y.z initial development phase?
> The simplest thing to do is start your initial development release at 0.1.0 and then increment the minor version for each subsequent release.
>
> How do I know when to release 1.0.0?
> If your software is being used in production, it should probably already be 1.0.0. If you have a stable API on which users have come to depend, you should be 1.0.0. If you’re worrying a lot about backward compatibility, you should probably already be 1.0.0.
>
> Doesn’t this discourage rapid development and fast iteration?
> Major version zero is all about rapid development. If you’re changing the API every day you should either still be in version 0.y.z or on a separate development branch working on the next major version.

Given that this workflow only drafts the release, you may manually edit the drafted release to rename and re-tag it with the version of your choosing if you wanted your first release to reflect 1.0.0 prior to publishing. If you are integrating this workflow into a repository that has tags, but no releases, you will need to perform this manual step to make sure your first true release follows your existing tags. If you integrate this workflow into a repository that has prior releases, the next drafted release will take the prior releases into account and will increment its version according to the tags found on the pull request that initiates the workflow run.
13 changes: 13 additions & 0 deletions docs/reusable-release-on-merge.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,16 @@ jobs:
```

Be sure you replace `ref` with an appropriate ref to this repository.

If this workflow runs in a repository without a prior Release being published, the first release will always be drafted with version 0.1.0. This is expected behavior and conforms to the SemVer spec, which permits a major version zero. From the SemVer documentation:

> How should I deal with revisions in the 0.y.z initial development phase?
> The simplest thing to do is start your initial development release at 0.1.0 and then increment the minor version for each subsequent release.
>
> How do I know when to release 1.0.0?
> If your software is being used in production, it should probably already be 1.0.0. If you have a stable API on which users have come to depend, you should be 1.0.0. If you’re worrying a lot about backward compatibility, you should probably already be 1.0.0.
>
> Doesn’t this discourage rapid development and fast iteration?
> Major version zero is all about rapid development. If you’re changing the API every day you should either still be in version 0.y.z or on a separate development branch working on the next major version.

Since this workflow publishes the release when a PR is merged (rather than leaving it in a drafted state), the first PR merge will generally result in version 0.1.0 being published. Do not integrate this workflow into a repository that contains tags but no releases, you must first create a Release with the last tagged version in order for the next PR merge to provide the correct version bump. If you integrate this workflow into a repository that has prior releases, the next release will take the prior releases into account and will increment its version according to the tags found on the pull request that initiates the workflow run.
20 changes: 20 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[project]
name = "launch-workflows-testing"
version = "0.0.0"
description = "Tests for the launch-workflows project"
readme = "README.md"
requires-python = ">=3.11"
dependencies = [
"gitpython>=3.1.45",
"pygithub>=2.7.0",
"pytest>=8.4.1",
"pytest-xdist>=3.8.0",
]

[tool.pytest.ini_options]
pythonpath = "src"
minversion = "8.0"
addopts = "-ra -n auto"
testpaths = [
"test"
]
Binary file removed src/__pycache__/launch_github.cpython-311.pyc
Binary file not shown.
Binary file removed src/__pycache__/launch_github.cpython-313.pyc
Binary file not shown.
Loading
Loading