drive-artifacts 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. drive_artifacts-0.1.0/.github/CODEOWNERS +1 -0
  2. drive_artifacts-0.1.0/.github/dependabot.yml +8 -0
  3. drive_artifacts-0.1.0/.github/workflows/ci.yml +93 -0
  4. drive_artifacts-0.1.0/.github/workflows/codeql.yml +24 -0
  5. drive_artifacts-0.1.0/.github/workflows/contract.yml +44 -0
  6. drive_artifacts-0.1.0/.github/workflows/e2e.yml +153 -0
  7. drive_artifacts-0.1.0/.github/workflows/release.yml +76 -0
  8. drive_artifacts-0.1.0/.gitignore +12 -0
  9. drive_artifacts-0.1.0/.pre-commit-config.yaml +24 -0
  10. drive_artifacts-0.1.0/CHANGELOG.md +21 -0
  11. drive_artifacts-0.1.0/CONTRIBUTING.md +13 -0
  12. drive_artifacts-0.1.0/LICENSE +201 -0
  13. drive_artifacts-0.1.0/PKG-INFO +203 -0
  14. drive_artifacts-0.1.0/README.md +176 -0
  15. drive_artifacts-0.1.0/SECURITY.md +14 -0
  16. drive_artifacts-0.1.0/action.yml +100 -0
  17. drive_artifacts-0.1.0/docs/index.md +79 -0
  18. drive_artifacts-0.1.0/docs/privacy.md +39 -0
  19. drive_artifacts-0.1.0/download/action.yml +65 -0
  20. drive_artifacts-0.1.0/pyproject.toml +122 -0
  21. drive_artifacts-0.1.0/src/drive_artifacts/__init__.py +4 -0
  22. drive_artifacts-0.1.0/src/drive_artifacts/__main__.py +6 -0
  23. drive_artifacts-0.1.0/src/drive_artifacts/_client.py +13 -0
  24. drive_artifacts-0.1.0/src/drive_artifacts/archive.py +332 -0
  25. drive_artifacts-0.1.0/src/drive_artifacts/cli.py +521 -0
  26. drive_artifacts-0.1.0/src/drive_artifacts/drive.py +581 -0
  27. drive_artifacts-0.1.0/src/drive_artifacts/errors.py +59 -0
  28. drive_artifacts-0.1.0/src/drive_artifacts/github.py +117 -0
  29. drive_artifacts-0.1.0/src/drive_artifacts/model.py +224 -0
  30. drive_artifacts-0.1.0/src/drive_artifacts/oauth.py +325 -0
  31. drive_artifacts-0.1.0/src/drive_artifacts/py.typed +0 -0
  32. drive_artifacts-0.1.0/src/drive_artifacts/settings.py +61 -0
  33. drive_artifacts-0.1.0/src/drive_artifacts/store.py +280 -0
  34. drive_artifacts-0.1.0/tests/__init__.py +0 -0
  35. drive_artifacts-0.1.0/tests/conftest.py +80 -0
  36. drive_artifacts-0.1.0/tests/contract/__init__.py +0 -0
  37. drive_artifacts-0.1.0/tests/contract/conftest.py +87 -0
  38. drive_artifacts-0.1.0/tests/contract/test_real_drive.py +191 -0
  39. drive_artifacts-0.1.0/tests/fake_drive.py +691 -0
  40. drive_artifacts-0.1.0/tests/fake_server.py +107 -0
  41. drive_artifacts-0.1.0/tests/integration/__init__.py +0 -0
  42. drive_artifacts-0.1.0/tests/integration/test_cli_subprocess.py +173 -0
  43. drive_artifacts-0.1.0/tests/test_action_yml.py +286 -0
  44. drive_artifacts-0.1.0/tests/test_archive.py +614 -0
  45. drive_artifacts-0.1.0/tests/test_cli.py +957 -0
  46. drive_artifacts-0.1.0/tests/test_contract_sweeper.py +43 -0
  47. drive_artifacts-0.1.0/tests/test_docstrings.py +36 -0
  48. drive_artifacts-0.1.0/tests/test_drive.py +1079 -0
  49. drive_artifacts-0.1.0/tests/test_errors.py +60 -0
  50. drive_artifacts-0.1.0/tests/test_fake_drive.py +954 -0
  51. drive_artifacts-0.1.0/tests/test_github.py +168 -0
  52. drive_artifacts-0.1.0/tests/test_model.py +366 -0
  53. drive_artifacts-0.1.0/tests/test_oauth.py +454 -0
  54. drive_artifacts-0.1.0/tests/test_release_yml.py +163 -0
  55. drive_artifacts-0.1.0/tests/test_settings.py +107 -0
  56. drive_artifacts-0.1.0/tests/test_store.py +723 -0
  57. drive_artifacts-0.1.0/uv.lock +1461 -0
@@ -0,0 +1 @@
1
+ * @davidnobles-eng
@@ -0,0 +1,8 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: github-actions
4
+ directory: /
5
+ schedule: { interval: weekly }
6
+ - package-ecosystem: uv
7
+ directory: /
8
+ schedule: { interval: weekly }
@@ -0,0 +1,93 @@
1
+ name: ci
2
+ on:
3
+ push:
4
+ branches: [main]
5
+ pull_request:
6
+ # `labeled`/`unlabeled` re-run the changelog gate when `skip-changelog` is added or removed.
7
+ types: [opened, synchronize, reopened, labeled, unlabeled]
8
+ permissions:
9
+ contents: read
10
+ concurrency:
11
+ group: ci-${{ github.ref }}
12
+ cancel-in-progress: true
13
+ jobs:
14
+ static:
15
+ runs-on: ubuntu-latest
16
+ timeout-minutes: 30
17
+ steps:
18
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
19
+ with:
20
+ persist-credentials: false
21
+ - uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
22
+ with:
23
+ enable-cache: true
24
+ python-version: "3.13"
25
+ - run: uv lock --check
26
+ - run: uv sync --all-groups
27
+ - run: uv run ruff check .
28
+ - run: uv run ruff format --check .
29
+ - run: uv run mypy
30
+ - run: uv run pyright
31
+ - run: uv run zizmor --min-severity low .github/workflows action.yml download/action.yml
32
+ - run: uv run actionlint
33
+ # Audit the locked third-party set. Auditing the live environment would also try the
34
+ # project itself, which is not on PyPI, and `--strict` turns that into a failure.
35
+ - run: uv export --quiet --frozen --all-groups --no-emit-project --output-file "$RUNNER_TEMP/requirements.txt"
36
+ - run: uv run pip-audit --strict --disable-pip --requirement "$RUNNER_TEMP/requirements.txt"
37
+ changelog:
38
+ if: github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'skip-changelog')
39
+ runs-on: ubuntu-latest
40
+ timeout-minutes: 10
41
+ steps:
42
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
43
+ with:
44
+ fetch-depth: 0
45
+ persist-credentials: false
46
+ - env:
47
+ BASE: ${{ github.event.pull_request.base.sha }}
48
+ HEAD: ${{ github.event.pull_request.head.sha }}
49
+ run: |
50
+ changed=$(git diff --name-only "$BASE...$HEAD")
51
+ if echo "$changed" | grep -q '^src/' && ! echo "$changed" | grep -q '^CHANGELOG.md$'; then
52
+ echo "::error::src/ changed but CHANGELOG.md did not (add the skip-changelog label to override)"
53
+ exit 1
54
+ fi
55
+ test:
56
+ needs: static
57
+ strategy:
58
+ fail-fast: false
59
+ matrix:
60
+ python: ["3.11", "3.12", "3.13", "3.14"]
61
+ runs-on: ubuntu-latest
62
+ timeout-minutes: 30
63
+ steps:
64
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
65
+ with:
66
+ persist-credentials: false
67
+ - uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
68
+ with:
69
+ enable-cache: true
70
+ python-version: ${{ matrix.python }}
71
+ # Only what the suite needs: the linters stay out of the test legs.
72
+ - run: uv sync --no-default-groups --group test
73
+ - run: uv run --no-sync pytest --cov --cov-report=term --cov-report=xml -m "not contract"
74
+ test-cross:
75
+ needs: static
76
+ strategy:
77
+ fail-fast: false
78
+ matrix:
79
+ os: [windows-latest, macos-latest]
80
+ python: ["3.11", "3.12", "3.13", "3.14"]
81
+ runs-on: ${{ matrix.os }}
82
+ timeout-minutes: 30
83
+ steps:
84
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
85
+ with:
86
+ persist-credentials: false
87
+ - uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
88
+ with:
89
+ enable-cache: true
90
+ python-version: ${{ matrix.python }}
91
+ # Only what the suite needs: the linters stay out of the test legs.
92
+ - run: uv sync --no-default-groups --group test
93
+ - run: uv run --no-sync pytest --cov --cov-report=term --cov-report=xml -m "not contract"
@@ -0,0 +1,24 @@
1
+ name: codeql
2
+ on:
3
+ push:
4
+ branches: [main]
5
+ pull_request:
6
+ schedule:
7
+ - cron: "33 5 * * 1"
8
+ permissions:
9
+ contents: read
10
+ jobs:
11
+ analyze:
12
+ runs-on: ubuntu-latest
13
+ permissions:
14
+ security-events: write # upload the results to code scanning
15
+ contents: read
16
+ actions: read # the analyze step reads its own workflow run
17
+ steps:
18
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
19
+ with:
20
+ persist-credentials: false
21
+ - uses: github/codeql-action/init@3ea37a44b6e4e6847c46edae209410d258d548d1 # v4.38.3
22
+ with:
23
+ languages: python, actions
24
+ - uses: github/codeql-action/analyze@3ea37a44b6e4e6847c46edae209410d258d548d1 # v4.38.3
@@ -0,0 +1,44 @@
1
+ name: contract
2
+ on:
3
+ schedule:
4
+ - cron: "17 4 * * *"
5
+ push:
6
+ branches: [main]
7
+ workflow_dispatch:
8
+ permissions:
9
+ contents: read
10
+ jobs:
11
+ # Stays green and does nothing until the repository has the DRIVE_ARTIFACTS_TOKEN secret.
12
+ gate:
13
+ runs-on: ubuntu-latest
14
+ timeout-minutes: 5
15
+ outputs:
16
+ ready: ${{ steps.check.outputs.ready }}
17
+ steps:
18
+ - id: check
19
+ env:
20
+ HAS_TOKEN: ${{ secrets.DRIVE_ARTIFACTS_TOKEN != '' }}
21
+ run: echo "ready=$HAS_TOKEN" >> "$GITHUB_OUTPUT"
22
+ contract:
23
+ needs: gate
24
+ if: needs.gate.outputs.ready == 'true'
25
+ runs-on: ubuntu-latest
26
+ timeout-minutes: 30
27
+ # One job at a time against the real Drive, shared with the e2e workflow.
28
+ concurrency:
29
+ group: real-drive
30
+ cancel-in-progress: false
31
+ steps:
32
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
33
+ with:
34
+ persist-credentials: false
35
+ - uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
36
+ with:
37
+ enable-cache: true
38
+ python-version: "3.13"
39
+ - run: uv sync --no-default-groups --group test
40
+ - env:
41
+ DRIVE_ARTIFACTS_TOKEN: ${{ secrets.DRIVE_ARTIFACTS_TOKEN }}
42
+ DRIVE_ARTIFACTS_CLIENT_ID: ${{ secrets.DRIVE_ARTIFACTS_CLIENT_ID }}
43
+ DRIVE_ARTIFACTS_CLIENT_SECRET: ${{ secrets.DRIVE_ARTIFACTS_CLIENT_SECRET }}
44
+ run: uv run --no-sync pytest tests/contract -m contract -q -ra
@@ -0,0 +1,153 @@
1
+ name: e2e
2
+ on:
3
+ push:
4
+ branches: [main]
5
+ workflow_dispatch:
6
+ permissions:
7
+ contents: read
8
+ # One run at a time against the real Drive, shared with the nightly contract workflow.
9
+ concurrency:
10
+ group: real-drive
11
+ cancel-in-progress: false
12
+ # The actions under test are used by path (`./`, `./download`). zizmor would prefer GitHub's `$/`
13
+ # form, but actionlint 1.7.x rejects it as a malformed reference and both linters gate CI, so
14
+ # the three local uses below carry a zizmor ignore for `self-repository`.
15
+ jobs:
16
+ # Stays green and does nothing until the repository has the DRIVE_ARTIFACTS_TOKEN secret.
17
+ gate:
18
+ runs-on: ubuntu-latest
19
+ timeout-minutes: 5
20
+ outputs:
21
+ ready: ${{ steps.check.outputs.ready }}
22
+ steps:
23
+ - id: check
24
+ env:
25
+ HAS_TOKEN: ${{ secrets.DRIVE_ARTIFACTS_TOKEN != '' }}
26
+ run: echo "ready=$HAS_TOKEN" >> "$GITHUB_OUTPUT"
27
+ upload:
28
+ needs: gate
29
+ if: needs.gate.outputs.ready == 'true'
30
+ runs-on: ubuntu-latest
31
+ timeout-minutes: 30
32
+ outputs:
33
+ digest: ${{ steps.up.outputs.artifact-digest }}
34
+ # The expected digests reach the download matrix as a job output: this
35
+ # repository stores nothing as a GitHub Actions artifact, its own action
36
+ # under test included.
37
+ expected-sha256: ${{ steps.expected.outputs.lines }}
38
+ steps:
39
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
40
+ with:
41
+ persist-credentials: false
42
+ # The zip is rooted at build/ itself, so the digests are taken relative to it. They are
43
+ # binary-mode (`*` marker) so the Windows check below never translates line endings.
44
+ - run: |
45
+ mkdir -p build/sub
46
+ echo "hello from $GITHUB_RUN_ID" > build/hello.txt
47
+ head -c 3000000 /dev/urandom > build/sub/noise.bin
48
+ (cd build && sha256sum --binary hello.txt sub/noise.bin) > expected.sha256
49
+ - id: expected
50
+ run: |
51
+ { echo 'lines<<EXPECTED_SHA256'; cat expected.sha256; echo 'EXPECTED_SHA256'; } >> "$GITHUB_OUTPUT"
52
+ - id: up
53
+ uses: ./ # zizmor: ignore[self-repository]
54
+ env: # only for a fork that tests against a client of its own; unset here
55
+ DRIVE_ARTIFACTS_CLIENT_ID: ${{ secrets.DRIVE_ARTIFACTS_CLIENT_ID }}
56
+ DRIVE_ARTIFACTS_CLIENT_SECRET: ${{ secrets.DRIVE_ARTIFACTS_CLIENT_SECRET }}
57
+ with:
58
+ name: e2e
59
+ path: |
60
+ build/
61
+ !build/**/*.tmp
62
+ token: ${{ secrets.DRIVE_ARTIFACTS_TOKEN }}
63
+ retention-days: 2
64
+ source: ${{ github.workspace }}
65
+ # Each step has its own $GITHUB_STEP_SUMMARY file, so the action's summary is not
66
+ # readable here; its outputs are.
67
+ - env:
68
+ DIGEST: ${{ steps.up.outputs.artifact-digest }}
69
+ ARTIFACT_ID: ${{ steps.up.outputs.artifact-id }}
70
+ SIZE: ${{ steps.up.outputs.size }}
71
+ run: |
72
+ [[ "$DIGEST" =~ ^sha256:[0-9a-f]{64}$ ]]
73
+ test -n "$ARTIFACT_ID"
74
+ test "$SIZE" -ge 3000000
75
+ download:
76
+ needs: upload
77
+ runs-on: ubuntu-latest
78
+ timeout-minutes: 30
79
+ steps:
80
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
81
+ with:
82
+ persist-credentials: false
83
+ - shell: bash
84
+ env:
85
+ EXPECTED: ${{ needs.upload.outputs.expected-sha256 }}
86
+ run: printf '%s\n' "$EXPECTED" > expected.sha256
87
+ - id: down
88
+ uses: ./download # zizmor: ignore[self-repository]
89
+ env: # only for a fork that tests against a client of its own; unset here
90
+ DRIVE_ARTIFACTS_CLIENT_ID: ${{ secrets.DRIVE_ARTIFACTS_CLIENT_ID }}
91
+ DRIVE_ARTIFACTS_CLIENT_SECRET: ${{ secrets.DRIVE_ARTIFACTS_CLIENT_SECRET }}
92
+ with:
93
+ name: e2e
94
+ path: restored
95
+ token: ${{ secrets.DRIVE_ARTIFACTS_TOKEN }}
96
+ source: ${{ github.workspace }}
97
+ - shell: bash
98
+ env:
99
+ UPLOADED: ${{ needs.upload.outputs.digest }}
100
+ DOWNLOADED: ${{ steps.down.outputs.artifact-digest }}
101
+ run: |
102
+ test "$UPLOADED" = "$DOWNLOADED"
103
+ cd restored && sha256sum -c ../expected.sha256
104
+ download-windows:
105
+ needs: upload
106
+ runs-on: windows-latest
107
+ timeout-minutes: 30
108
+ steps:
109
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
110
+ with:
111
+ persist-credentials: false
112
+ - shell: bash
113
+ env:
114
+ EXPECTED: ${{ needs.upload.outputs.expected-sha256 }}
115
+ run: printf '%s\n' "$EXPECTED" > expected.sha256
116
+ - id: down
117
+ uses: ./download # zizmor: ignore[self-repository]
118
+ env: # only for a fork that tests against a client of its own; unset here
119
+ DRIVE_ARTIFACTS_CLIENT_ID: ${{ secrets.DRIVE_ARTIFACTS_CLIENT_ID }}
120
+ DRIVE_ARTIFACTS_CLIENT_SECRET: ${{ secrets.DRIVE_ARTIFACTS_CLIENT_SECRET }}
121
+ with:
122
+ name: e2e
123
+ path: restored
124
+ token: ${{ secrets.DRIVE_ARTIFACTS_TOKEN }}
125
+ source: ${{ github.workspace }}
126
+ - shell: bash
127
+ env:
128
+ UPLOADED: ${{ needs.upload.outputs.digest }}
129
+ DOWNLOADED: ${{ steps.down.outputs.artifact-digest }}
130
+ run: |
131
+ test "$UPLOADED" = "$DOWNLOADED"
132
+ cd restored && sha256sum -c ../expected.sha256
133
+ latest:
134
+ needs: download
135
+ runs-on: ubuntu-latest
136
+ timeout-minutes: 30
137
+ steps:
138
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
139
+ with:
140
+ persist-credentials: false
141
+ # This run's own ref, not a fixed main: a manual dispatch from a branch uploads under
142
+ # that branch's ref, and its newest artifact must be the one this run just stored.
143
+ - uses: ./download # zizmor: ignore[self-repository]
144
+ env: # only for a fork that tests against a client of its own; unset here
145
+ DRIVE_ARTIFACTS_CLIENT_ID: ${{ secrets.DRIVE_ARTIFACTS_CLIENT_ID }}
146
+ DRIVE_ARTIFACTS_CLIENT_SECRET: ${{ secrets.DRIVE_ARTIFACTS_CLIENT_SECRET }}
147
+ with:
148
+ name: e2e
149
+ ref: ${{ github.ref }}
150
+ path: latest
151
+ token: ${{ secrets.DRIVE_ARTIFACTS_TOKEN }}
152
+ source: ${{ github.workspace }}
153
+ - run: grep -q "hello from $GITHUB_RUN_ID" latest/hello.txt
@@ -0,0 +1,76 @@
1
+ name: release
2
+ on:
3
+ push:
4
+ tags: ["v[0-9]+.[0-9]+.[0-9]+"]
5
+ permissions:
6
+ contents: read
7
+ jobs:
8
+ verify:
9
+ runs-on: ubuntu-latest
10
+ timeout-minutes: 30
11
+ steps:
12
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
13
+ with:
14
+ persist-credentials: false
15
+ - env:
16
+ TAG: ${{ github.ref_name }}
17
+ run: |
18
+ version="${TAG#v}"
19
+ grep -q "^version = \"$version\"$" pyproject.toml || { echo "::error::pyproject version != $version"; exit 1; }
20
+ grep -q "default: drive-artifacts==$version$" action.yml || { echo "::error::action.yml source pin != $version"; exit 1; }
21
+ grep -q "default: drive-artifacts==$version$" download/action.yml || { echo "::error::download/action.yml source pin != $version"; exit 1; }
22
+ grep -q "^## \[$version\]" CHANGELOG.md || { echo "::error::CHANGELOG.md has no section for $version"; exit 1; }
23
+ - uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
24
+ with:
25
+ enable-cache: false
26
+ python-version: "3.13"
27
+ - run: uv sync --locked --all-groups && uv run pytest -q -m "not contract"
28
+ # Build, PyPI and the GitHub Release are one job: the wheel never leaves the
29
+ # runner, so nothing is stored as a GitHub Actions artifact.
30
+ publish:
31
+ needs: verify
32
+ runs-on: ubuntu-latest
33
+ timeout-minutes: 30
34
+ environment: pypi
35
+ permissions:
36
+ id-token: write # PyPI trusted publishing
37
+ contents: write # create the release and move the major tag
38
+ steps:
39
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
40
+ with:
41
+ persist-credentials: false
42
+ - uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
43
+ with:
44
+ enable-cache: false
45
+ python-version: "3.13"
46
+ - run: uv build
47
+ # skip-existing: a re-run after a later step failed must not fail on the upload.
48
+ - run: uv publish --trusted-publishing always --check-url https://pypi.org/simple/drive-artifacts/
49
+ - env:
50
+ GH_TOKEN: ${{ github.token }}
51
+ TAG: ${{ github.ref_name }}
52
+ REPO: ${{ github.repository }}
53
+ SHA: ${{ github.sha }}
54
+ run: |
55
+ version="${TAG#v}"
56
+ # This version's section: from its heading to the next one, without the link
57
+ # definitions that end the file.
58
+ awk -v v="$version" '/^## \[/{p = index($0, "[" v "]") > 0} /^\[[^]]+\]: /{p = 0} p' CHANGELOG.md > notes.md
59
+ # A re-run of this job must not fail on a release that already exists.
60
+ gh release view "$TAG" >/dev/null 2>&1 || gh release create "$TAG" dist/* --title "$TAG" --notes-file notes.md
61
+ major="v${version%%.*}"
62
+ # `uses: ...@v0` resolves to the major tag, so it only ever moves forward: a re-run
63
+ # of an older release must not take every caller back to it.
64
+ newest=$(gh api "repos/$REPO/git/matching-refs/tags/$major." --jq '.[].ref' | sed 's#^refs/tags/##' | { grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' || true; } | sort -V | tail -n 1)
65
+ if [ -n "$newest" ] && [ "$newest" != "$TAG" ]; then
66
+ echo "::notice::$major stays at $newest; $TAG is not the newest release of its major"
67
+ exit 0
68
+ fi
69
+ # Singular `git/ref/...` is an exact match. The plural `git/refs/tags/$major` matches by
70
+ # prefix (`v0` finds `v0.1.0`), so it would report a missing major tag as present and
71
+ # the PATCH below would then fail. Do not "fix" this back to the plural form.
72
+ if gh api "repos/$REPO/git/ref/tags/$major" >/dev/null 2>&1; then
73
+ gh api -X PATCH "repos/$REPO/git/refs/tags/$major" -f sha="$SHA" -F force=true
74
+ else
75
+ gh api -X POST "repos/$REPO/git/refs" -f ref="refs/tags/$major" -f sha="$SHA"
76
+ fi
@@ -0,0 +1,12 @@
1
+ .venv/
2
+ __pycache__/
3
+ *.pyc
4
+ dist/
5
+ .coverage
6
+ coverage.xml
7
+ htmlcov/
8
+ .hypothesis/
9
+ .mypy_cache/
10
+ .ruff_cache/
11
+ .pytest_cache/
12
+ .claude/worktrees/
@@ -0,0 +1,24 @@
1
+ repos:
2
+ - repo: local
3
+ hooks:
4
+ - id: ruff-check
5
+ name: ruff check
6
+ entry: uv run ruff check --fix
7
+ language: system
8
+ types: [python]
9
+ - id: ruff-format
10
+ name: ruff format
11
+ entry: uv run ruff format
12
+ language: system
13
+ types: [python]
14
+ - id: mypy
15
+ name: mypy
16
+ entry: uv run mypy
17
+ language: system
18
+ pass_filenames: false
19
+ - id: zizmor
20
+ name: zizmor
21
+ entry: uv run zizmor --min-severity low .github/workflows action.yml download/action.yml
22
+ language: system
23
+ pass_filenames: false
24
+ files: ^(\.github/|action\.yml|download/action\.yml)
@@ -0,0 +1,21 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented here. The format follows
4
+ [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the project uses
5
+ [Semantic Versioning](https://semver.org/).
6
+
7
+ ## [Unreleased]
8
+
9
+ ## [0.1.0] - 2026-11-18
10
+
11
+ ### Added
12
+
13
+ - `drive-artifacts` CLI: `login`, `upload`, `download`, `list`, `prune`, `logout`, `whoami`.
14
+ - Composite actions `TheChaosBureau/drive-artifacts` (upload) and `TheChaosBureau/drive-artifacts/download`.
15
+ - One zip per artifact, flat per-repository folder in Drive, identity in `appProperties`.
16
+ - Resumable uploads, ranged downloads, retries with full-jitter backoff, digest verification.
17
+ - Retention days with pruning, overwrite, `if-no-files-found`, hidden-file handling.
18
+ - `drive.file`-only OAuth with a shipped desktop client; token stored as a GitHub secret.
19
+
20
+ [Unreleased]: https://github.com/TheChaosBureau/drive-artifacts/compare/v0.1.0...HEAD
21
+ [0.1.0]: https://github.com/TheChaosBureau/drive-artifacts/releases/tag/v0.1.0
@@ -0,0 +1,13 @@
1
+ # Contributing
2
+
3
+ - `uv sync --all-groups && uv run pre-commit install`
4
+ - Tests first. Every change to `src/` comes with tests under `tests/` and a line
5
+ in `CHANGELOG.md` under *Unreleased*; CI checks the changelog. A change that
6
+ needs no entry gets the `skip-changelog` label, and adding or removing the
7
+ label re-runs the check.
8
+ - `ruff`, `mypy --strict`, `pyright`, `zizmor` and `actionlint` must be clean;
9
+ coverage must stay at or above 95 %.
10
+ - Workflows pin actions by full SHA with a `# vX.Y.Z` comment, and pass inputs to
11
+ `run:` only through `env:`.
12
+ - Keep the Drive surface small. New Drive calls go in `drive.py` and get a fake
13
+ implementation in `tests/fake_drive.py` first.