88 required : false
99 type : string
1010 default : ' 3.11'
11+ pull_request :
12+ paths :
13+ - ' .github/workflows/update.yml'
14+ - ' Makefile'
15+ - ' requirements.txt'
16+ branches :
17+ - ' 3.11'
1118 push :
1219 paths :
1320 - ' .github/workflows/update.yml'
1421 - ' Makefile'
22+ - ' requirements.txt'
1523 branches :
1624 - ' 3.11'
1725 - ' 3.10'
@@ -35,12 +43,17 @@ jobs:
3543 with :
3644 persist-credentials : false
3745
38- - name : Extract branch name
39- if : github.event != 'workflow_dispatch'
40- shell : bash
41- run : echo "BRANCH=$(echo ${GITHUB_REF#refs/heads/})" >>$GITHUB_ENV
46+ - name : Get branch name on push or schedule
47+ if : |
48+ github.event == 'push' ||
49+ github.event == 'schedule'
50+ run : echo "BRANCH=${GITHUB_REF_NAME}" >>$GITHUB_ENV
4251
43- - name : ... or set branch name if manually run
52+ - name : Get branch name on pull
53+ if : github.event == 'pull_request'
54+ run : echo "BRANCH=${GITHUB_BASE_REF}" >>$GITHUB_ENV
55+
56+ - name : Get branch name on manual run
4457 if : github.event == 'workflow_dispatch'
4558 run : echo "BRANCH=${{ github.event.inputs.BRANCH }}" >> $GITHUB_ENV
4659
5871 cache : ' pip'
5972 cache-dependency-path : |
6073 'requirements.txt'
61- '${{ env.CPYTHON_DIR }} /requirements.txt'
74+ 'cpython /requirements.txt'
6275
6376 - name : Install dependencies
6477 run : sudo apt update -y && sudo apt install gettext tree -y
87100
88101 # Job for getting po files downloaded and storing this repository
89102 push :
90- if : github.repository == 'python/python-docs-pt-br'
91103 name : Push to repo
92104 needs : [pull]
93105 runs-on : ubuntu-latest
@@ -102,10 +114,17 @@ jobs:
102114 with :
103115 name : translations
104116
117+ # Exclude file with only changes in POT-Creation-Date
105118 - name : Changed files
106- run : git status
107-
119+ shell : bash
120+ run : |
121+ git diff -I'^"POT-Creation-Date: ' --numstat *.po **/*.po | cut -f3
122+ git ls-files -o --exclude-standard *.po **/*.po
123+
108124 - name : Commit and push changes
125+ if : |
126+ github.repository == 'python/python-docs-pt-br' &&
127+ github.event != 'pull_request
109128 run : |
110129 git config user.name github-actions
111130 git config user.email github-actions@github.com
@@ -132,10 +151,19 @@ jobs:
132151 - branch : 3.10
133152 overwrite : true
134153 steps :
135- - name : Get current branch name
136- shell : bash
137- run :
138- echo "CURRENT_BRANCH=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV
154+ - name : Get branch name on push or schedule
155+ if : |
156+ github.event == 'push' ||
157+ github.event == 'schedule'
158+ run : echo "CURRENT_BRANCH=${GITHUB_REF_NAME}" >>$GITHUB_ENV
159+
160+ - name : Get branch name on pull
161+ if : github.event == 'pull_request'
162+ run : echo "CURRENT_BRANCH=${GITHUB_BASE_REF}" >>$GITHUB_ENV
163+
164+ - name : Get branch name on manual run
165+ if : github.event == 'workflow_dispatch'
166+ run : echo "CURRENT_BRANCH=${{ github.event.inputs.BRANCH }}" >> $GITHUB_ENV
139167
140168 - name : Check out source branch (${{ env.CURRENT_BRANCH }})
141169 uses : actions/checkout@v3
@@ -177,7 +205,9 @@ jobs:
177205
178206 # TODO: Solve make push to work with merge scenario
179207 - name : Commit and push changes
180- if : github.repository == 'python/python-docs-pt-br'
208+ if : |
209+ github.repository == 'python/python-docs-pt-br' &&
210+ github.event != 'pull_request
181211 run : |
182212 git config user.name github-actions
183213 git config user.email github-actions@github.com
@@ -191,5 +221,6 @@ jobs:
191221 call-build :
192222 name : call
193223 needs : pull
224+ if : github.event != 'pull_request'
194225 uses : ./.github/workflows/check.yml
195226 secrets : inherit
0 commit comments