8000 feat(gh-action): add cron for syncing with CPython · python/python-docs-zh-tw@e2e01d5 · GitHub
[go: up one dir, main page]

Skip to content

Commit e2e01d5

Browse files
committed
feat(gh-action): add cron for syncing with CPython
1 parent 2097fa6 commit e2e01d5

File tree

2 files changed

+59
-3
lines changed

2 files changed

+59
-3
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: python-3.9-sync-with-cpython
2+
3+
on:
4+
push:
5+
branches:
6+
- "3.9"
7+
schedule:
8+
- cron: "0 0 * * *"
9+
10+
jobs:
11+
sync:
12+
runs-on: ubuntu-latest
13+
env:
14+
VERSION: "3.9"
15+
steps:
16+
- uses: actions/checkout@v2
17+
with:
18+
ref: ${{ env.VERSION }}
19+
20+
- name: Set env
21+
run: echo "LATEST_COMMIT_ID=$(git ls-remote https://github.com/python/CPython.git $VERSION | head -c 8)" >> $GITHUB_ENV
22+
23+
- name: Install Dependencies
24+
run: sudo apt-get install gettext
25+
26+
- name: Sync with CPython
27+
run: make clone && make merge && make rm_cpython
28+
29+
- name: Create Pull Request
30+
id: cpr
31+
uses: peter-evans/create-pull-request@v3
32+
with:
33+
commit-message: sync with cpython ${{ env.LATEST_COMMIT_ID }}
34+
committer: GitHub <noreply@github.com>
35+
author: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
36+
base: ${{ env.VERSION }}
37+
branch: cron/sync/${{ env.VERSION }}
38+
delete-branch: true
39+
title: 'Sync with CPython ${{ env.VERSION }}'
40+
body: |
41+
Sync with CPython ${{ env.VERSION }}
42+
labels: |
43+
sync-cpython
44+
automation
45+
team-reviewers: |
46+
owners
47+
maintainers
48+
49+
- name: Check outputs
50+
run: |
51+
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
52+
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"

Makefile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ JOBS = 1
2727

2828

2929
.PHONY: all
30-
all: $(VENV)/bin/sphinx-build $(VENV)/bin/blurb $(SPHINX_CONF)
30+
all: $(VENV)/bin/sphinx-build $(VENV)/bin/blurb clone
3131
mkdir -p $(LC_MESSAGES)
3232
for dirname in $$(find . -name '*.po' | xargs -n1 dirname | sort -u | grep -v '^\.$$'); do mkdir -p $(LC_MESSAGES)/$$dirname; done
3333
for file in *.po */*.po; do ln -f $$file $(LC_MESSAGES)/$$file; done
3434
. $(VENV)/bin/activate; $(MAKE) -C $(CPYTHON_CLONE)/Doc/ SPHINXOPTS='-j$(JOBS) -D locale_dirs=locales -D language=$(LANGUAGE) -D gettext_compact=0' $(MODE)
3535

3636

37-
$(SPHINX_CONF):
38-
git clone --depth 1 --no-single-branch https://github.com/python/cpython.git $(CPYTHON_CLONE)
37+
clone:
38+
git clone --depth 1 --no-single-branch https://github.com/python/cpython.git $(CPYTHON_CLONE) || echo "cpython exists"
3939
cd $(CPYTHON_CLONE) && git checkout $(BRANCH)
4040

4141

@@ -104,3 +104,7 @@ update_txconfig:
104104
.PHONY: fuzzy
105105
fuzzy:
106106
for file in *.po */*.po; do echo $$(msgattrib --only-fuzzy --no-obsolete "$$file" | grep -c '#, fuzzy') $$file; done | grep -v ^0 | sort -gr
107+
108+
.PHONY: rm_cpython
109+
rm_cpython:
110+
rm -rf $(CPYTHON_CLONE)

0 commit comments

Comments
 (0)
0