Skip to content

Commit 29b4f77

Browse files
committed
refactor GitHub Action for clarity, specificty, and to resolve "failed to push some refs" error
1 parent 2dc127d commit 29b4f77

File tree

1 file changed

+28
-24
lines changed

1 file changed

+28
-24
lines changed

.github/workflows/1-fetch.yml

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -17,47 +17,51 @@ jobs:
1717
fetch:
1818
runs-on: ubuntu-latest
1919

20-
env:
21-
GCS_DEVELOPER_KEY: ${{ secrets.GCS_DEVELOPER_KEY }}
22-
GCS_CX: ${{ secrets.GCS_CX }}
20+
steps:
2321

24-
# CC Technology team members:
25-
# See cc-quantifying-bot GitHub entry in Bitwarden for information on
26-
# BOT_ secrets
22+
# CC Technology team members:
23+
# See cc-quantifying-bot GitHub entry in Bitwarden for information on
24+
# BOT_ secrets
25+
- name: Configure git
26+
run: |
27+
git config --global init.defaultBranch main
28+
git config --global user.name "${{ secrets.BOT_NAME }}"
29+
git config --global user.email "${{ secrets.BOT_EMAIL }}"
2730
28-
steps:
2931
- name: Checkout repository
3032
uses: actions/checkout@v4
3133
with:
34+
# Default fetch-depth is 1, however that value results in errors
35+
# when GitPython attempts to push changes:
36+
# "failed to push some refs"
37+
fetch-depth: 10
3238
token: ${{ secrets.BOT_TOKEN }}
3339

34-
- name: Configure git
35-
run: |
36-
git config user.name "${{ secrets.BOT_NAME }}"
37-
git config user.email "${{ secrets.BOT_EMAIL }}"
38-
3940
- name: Set up Python
4041
uses: actions/setup-python@v5
4142
with:
4243
python-version: '3.11'
4344

44-
- name: Install dependencies
45+
- name: Install Python dependencies
4546
run: |
46-
pip install --upgrade pip
47-
pip install pipenv
48-
pipenv sync --system
47+
pip install --upgrade pip pipenv
4948
50-
- name: Set PYTHONPATH
51-
run: echo "PYTHONPATH=./scripts" >> $GITHUB_ENV
49+
- name: Sync Python modules
50+
run: |
51+
pipenv sync --system
5252
53-
# - name: Fetch from Google Custom Search (GCS)
54-
# run: |
55-
# ./scripts/1-fetch/gcs_fetch.py \
56-
# --limit=100 --enable-save --enable-git
53+
# CC Technology team members:
54+
# See cc-quantifying-bot Google Workspace entry in Bitwarden for
55+
# information on GCS_ secrets
56+
- name: Fetch from Google Custom Search (GCS)
57+
run: |
58+
./scripts/1-fetch/gcs_fetch.py \
59+
--limit=100 --enable-save --enable-git
60+
env:
61+
GCS_DEVELOPER_KEY: ${{ secrets.GCS_DEVELOPER_KEY }}
62+
GCS_CX: ${{ secrets.GCS_CX }}
5763

5864
- name: Fetch from GitHub
5965
run: |
6066
./scripts/1-fetch/github_fetch.py \
6167
--enable-save --enable-git
62-
env:
63-
GIT_PYTHON_TRACE: full

0 commit comments

Comments
 (0)