-
Notifications
You must be signed in to change notification settings - Fork 6k
69 lines (62 loc) · 2.49 KB
/
chango.yml
File metadata and controls
69 lines (62 loc) · 2.49 KB
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
name: Chango
on:
pull_request:
types:
- opened
- reopened
- synchronize
permissions: {}
jobs:
create-chango-fragment:
permissions:
# Give the default GITHUB_TOKEN write permission to commit and push the
# added or changed files to the repository.
contents: write
name: Create chango Fragment
runs-on: ubuntu-latest
outputs:
IS_RELEASE_PR: ${{ steps.check_title.outputs.IS_RELEASE_PR }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
# needed for commit and push step at the end
persist-credentials: true
- name: Check PR Title
id: check_title
run: | # zizmor: ignore[template-injection]
if [[ "$(echo "${{ github.event.pull_request.title }}" | tr '[:upper:]' '[:lower:]')" =~ ^bump\ version\ to\ .* ]]; then
echo "COMMIT_AND_PUSH=false" >> $GITHUB_OUTPUT
echo "IS_RELEASE_PR=true" >> $GITHUB_OUTPUT
else
echo "COMMIT_AND_PUSH=true" >> $GITHUB_OUTPUT
echo "IS_RELEASE_PR=false" >> $GITHUB_OUTPUT
fi
# Create the new fragment
- uses: Bibo-Joshi/chango@bc58df46ef3ba8f15b8d744929998b7ae8a222d4 # 0.6.1
with:
# passing this custom token has two purposes
# 1. it allows us to fetch info about issue types
# 2. it ensures that the push will also re-trigger workflows
github-token: ${{ secrets.CHANGO_PAT }}
query-issue-types: true
commit-and-push: ${{ steps.check_title.outputs.COMMIT_AND_PUSH }}
# Run `chango release` if applicable - needs some additional setup.
- name: Set up Python
if: steps.check_title.outputs.IS_RELEASE_PR == 'true'
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: "3.x"
- name: Do Release
if: steps.check_title.outputs.IS_RELEASE_PR == 'true'
run: |
cd ./target-repo
git add changes/unreleased/*
pip install . --group docs
VERSION_TAG=$(python -c "from telegram import __version__; print(f'{__version__}')")
chango release --uid $VERSION_TAG
- name: Commit & Push
if: steps.check_title.outputs.IS_RELEASE_PR == 'true'
uses: stefanzweifel/git-auto-commit-action@04702edda442b2e678b25b537cec683a1493fcb9 # v7.1.0
with:
commit_message: "Do chango Release"
repository: ./target-repo