Skip to content

Commit d80821b

Browse files
authored
ci: commit traffic data with git instead of add-and-commit
1 parent 0b9997a commit d80821b

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

.github/workflows/traffic.yml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
traffic:
2121
runs-on: ubuntu-latest
2222
permissions:
23-
# Needed by add-and-commit to push the CSV files to the `traffic` branch.
23+
# Needed to push the CSV files to the `traffic` branch.
2424
contents: write
2525
steps:
2626
- name: 'Checkout traffic branch'
@@ -34,9 +34,13 @@ jobs:
3434
TRAFFIC_ACTION_TOKEN: ${{ secrets.TRAFFIC_ACTION_TOKEN }}
3535

3636
- name: 'Commit traffic data'
37-
uses: EndBug/add-and-commit@290ea2c423ad77ca9c62ae0f5b224379612c0321 # v10.0.0
38-
with:
39-
message: 'chore: update repository traffic stats'
40-
add: './traffic/*'
41-
# Commits to the dedicated `traffic` branch.
42-
new_branch: 'traffic'
37+
run: |
38+
git config user.name 'github-actions[bot]'
39+
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
40+
git add ./traffic/
41+
if git diff --cached --quiet; then
42+
echo 'No traffic changes to commit.'
43+
exit 0
44+
fi
45+
git commit -m 'chore: update repository traffic stats'
46+
git push origin HEAD:traffic

0 commit comments

Comments
 (0)