FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
typer/.github/workflows/pre-commit.yml at master · fastapi/typer · GitHub
fastapi
typer
Repository navigation
Code
Issues
1
(1)
Pull requests
45
(45)
Discussions
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
typer
/
.github
/
workflows
/
pre-commit.yml
Copy path
View runs
More file actions
More file actions
Latest commit
History
History
History
108 lines (104 loc) · 3.81 KB
Breadcrumbs
typer
/
.github
/
workflows
/
pre-commit.yml
Copy path
File metadata and controls
108 lines (104 loc) · 3.81 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
name
:
pre-commit
on
:
pull_request
:
permissions
:
{}
env
:
CAN_PUSH
:
${{ github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]' }}
jobs
:
pre-commit
:
runs-on
:
ubuntu-latest
permissions
:
contents
:
read
id-token
:
write
timeout-minutes
:
5
steps
:
-
name
:
Dump GitHub context
env
:
GITHUB_CONTEXT
:
${{ toJson(github) }}
run
:
echo "$GITHUB_CONTEXT"
-
uses
:
actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
#
v7.0.1
name
:
Checkout PR for own repo
if
:
env.CAN_PUSH == 'true'
with
:
#
To be able to commit it needs to fetch the head of the branch, not the
#
merge commit
ref
:
${{ github.head_ref }}
#
And it needs the full history to be able to compute diffs
fetch-depth
:
0
persist-credentials
:
false
#
pre-commit lite ci needs the default checkout configs to work
-
uses
:
actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
#
v7.0.1
name
:
Checkout PR for fork
if
:
env.CAN_PUSH == 'false'
with
:
#
To be able to commit it needs the head branch of the PR, the remote one
ref
:
${{ github.event.pull_request.head.sha }}
fetch-depth
:
0
persist-credentials
:
false
-
name
:
Set up Python
uses
:
actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97
#
v7.0.0
with
:
python-version-file
:
"
.python-version
"
-
name
:
Setup uv
uses
:
astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7
#
v10.2.0
with
:
version
:
"
latest-known
"
cache-dependency-glob
:
|
pyproject.toml
uv.lock
-
name
:
Install Dependencies
run
:
uv sync --locked
-
name
:
Run prek - pre-commit
id
:
precommit
run
:
uv run prek run --from-ref origin/${GITHUB_BASE_REF} --to-ref HEAD --show-diff-on-failure
continue-on-error
:
true
-
name
:
Check for changes
id
:
changes
run
:
|
if [[ -n "$(git status --porcelain)" ]]; then
echo "changed=true" >> "$GITHUB_OUTPUT"
else
echo "changed=false" >> "$GITHUB_OUTPUT"
fi
-
name
:
Get PR Push token
id
:
pr-push
if
:
env.CAN_PUSH == 'true' && steps.changes.outputs.changed == 'true'
uses
:
tiangolo/pr-push@f336b3817f32ea9b8273a8c15f8ecb739ac38167
#
0.0.4
-
name
:
Commit and push changes
if
:
env.CAN_PUSH == 'true' && steps.changes.outputs.changed == 'true'
env
:
GH_TOKEN
:
${{ steps.pr-push.outputs.token }}
run
:
|
git config user.name "pr-push[bot]"
git config user.email "pr-push[bot]@users.noreply.github.com"
gh auth setup-git
git add -A
if git diff --staged --quiet; then
echo "No changes to commit"
else
git commit -m "🎨 Auto format"
git push
fi
-
uses
:
pre-commit-ci/lite-action@5d6cc0eb514c891a40562a58a8e71576c5c7fb43
#
v1.1.0
if
:
env.CAN_PUSH == 'false'
with
:
msg
:
🎨 Auto format
-
name
:
Error out on pre-commit errors
if
:
steps.precommit.outcome == 'failure'
run
:
exit 1
#
https://github.com/marketplace/actions/alls-green#why
pre-commit-alls-green
:
#
This job does nothing and is only used for the branch protection
if
:
always()
needs
:
-
pre-commit
runs-on
:
ubuntu-latest
timeout-minutes
:
5
steps
:
-
name
:
Dump GitHub context
env
:
GITHUB_CONTEXT
:
${{ toJson(github) }}
run
:
echo "$GITHUB_CONTEXT"
-
name
:
Decide whether the needed jobs succeeded or failed
uses
:
re-actors/alls-green@b5b5b37504aa4183270bd3d855c52a67f212be35
#
v1.3.0
with
:
jobs
:
${{ toJSON(needs) }}
Back
|
FazBrowse Home
|
New Git URL