Skip to content

Commit d40f5ac

Browse files
committed
chore: group steps for committing the changes together so they all have initialized git env vars
Correction for 2263615 commit. Part of #1610
1 parent e5b1072 commit d40f5ac

File tree

1 file changed

+28
-28
lines changed

1 file changed

+28
-28
lines changed

Diff for: .github/workflows/todos-extract-from-code.yml

+28-28
Original file line numberDiff line numberDiff line change
@@ -96,34 +96,6 @@ jobs:
9696
# Make variable available for the next steps
9797
echo "PUZZLES_FILES_MODIFIED=$PUZZLES_FILES_MODIFIED" | tee -a "$GITHUB_ENV"
9898
99-
- name: Initialize Git variables for committing the changes
100-
if: env.PUZZLES_FILES_MODIFIED == 'yes'
101-
run: |
102-
AUTHOR_EMAIL="$(git show "$GITHUB_SHA" --no-patch --format=%aE)"
103-
AUTHOR_NAME="$(git show "$GITHUB_SHA" --no-patch --format=%aN)"
104-
105-
# Make variables available for the next steps
106-
(
107-
echo "COMMIT_MSG=$(git show "$GITHUB_SHA" --no-patch --format=oneline --abbrev-commit)"
108-
echo "GIT_AUTHOR_NAME=GitHub Action on behalf of $AUTHOR_NAME"
109-
echo "GIT_COMMITTER_NAME=GitHub Action on behalf of $AUTHOR_NAME"
110-
echo "GIT_AUTHOR_EMAIL=$AUTHOR_EMAIL"
111-
echo "GIT_COMMITTER_EMAIL=$AUTHOR_EMAIL"
112-
) | tee -a "$GITHUB_ENV"
113-
114-
- name: Commit the changes
115-
if: env.PUZZLES_FILES_MODIFIED == 'yes'
116-
env:
117-
NEW_COMMIT_MSG: "chore: processed ${{ env.COMMIT_MSG }}"
118-
working-directory: generated-todos
119-
run: |
120-
for FILE in pdd.xml todos-in-code.tsv; do
121-
mv -f ../$FILE .
122-
git add $FILE
123-
done
124-
git commit --all -m "$NEW_COMMIT_MSG"
125-
git push
126-
12799
# It's possible that for some puzzles we haven't created issues yet
128100
# (because of network, rate limit or other kind of errors)
129101
- name: Check whether there are puzzles without related issues
@@ -165,6 +137,34 @@ jobs:
165137
# Make variable available for the next steps
166138
echo "PUZZLES_MAPPING_MODIFIED=$PUZZLES_MAPPING_MODIFIED" | tee -a "$GITHUB_ENV"
167139
140+
- name: Initialize Git variables for committing the changes
141+
if: env.PUZZLES_FILES_MODIFIED == 'yes' || env.PUZZLES_MAPPING_MODIFIED == 'yes'
142+
run: |
143+
AUTHOR_EMAIL="$(git show "$GITHUB_SHA" --no-patch --format=%aE)"
144+
AUTHOR_NAME="$(git show "$GITHUB_SHA" --no-patch --format=%aN)"
145+
146+
# Make variables available for the next steps
147+
(
148+
echo "COMMIT_MSG=$(git show "$GITHUB_SHA" --no-patch --format=oneline --abbrev-commit)"
149+
echo "GIT_AUTHOR_NAME=GitHub Action on behalf of $AUTHOR_NAME"
150+
echo "GIT_COMMITTER_NAME=GitHub Action on behalf of $AUTHOR_NAME"
151+
echo "GIT_AUTHOR_EMAIL=$AUTHOR_EMAIL"
152+
echo "GIT_COMMITTER_EMAIL=$AUTHOR_EMAIL"
153+
) | tee -a "$GITHUB_ENV"
154+
155+
- name: Commit the changes
156+
if: env.PUZZLES_FILES_MODIFIED == 'yes'
157+
env:
158+
NEW_COMMIT_MSG: "chore: processed ${{ env.COMMIT_MSG }}"
159+
working-directory: generated-todos
160+
run: |
161+
for FILE in pdd.xml todos-in-code.tsv; do
162+
mv -f ../$FILE .
163+
git add $FILE
164+
done
165+
git commit --all -m "$NEW_COMMIT_MSG"
166+
git push
167+
168168
- name: Commit updated mapping
169169
if: env.PUZZLES_MAPPING_MODIFIED == 'yes'
170170
env:

0 commit comments

Comments
 (0)