Skip to content

Commit

Permalink
Updated workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
p-miano committed Oct 10, 2024
1 parent e50c1c0 commit 0117576
Showing 1 changed file with 10 additions and 37 deletions.
47 changes: 10 additions & 37 deletions .github/workflows/update_repo_data.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ jobs:
runs-on: ubuntu-latest

steps:
# Step 1: Checkout the repository
- name: Checkout Repository
# Step 1: Checkout the repository and gh-pages branch
- name: Checkout gh-pages Branch
uses: actions/checkout@v3
with:
ref: gh-pages
Expand Down Expand Up @@ -69,43 +69,16 @@ jobs:
cat repo_data.json
# Step EXTRA: Log JSON File Contents Before Commit
- name: Log JSON File Contents
- name: Log JSON File Contents Before Commit
run: |
echo "Contents of repo_data.json before attempting to commit:"
cat repo_data.json
# Step 5: Remove the untracked JSON file if it exists
- name: Remove Untracked JSON File
run: |
if [ -f repo_data.json ]; then
echo "Removing existing repo_data.json to avoid conflicts when switching branches."
rm repo_data.json
fi
# Step 6: Checkout gh-pages branch
- name: Checkout gh-pages Branch
run: |
git fetch
git checkout gh-pages
# Step EXTRA: Log JSON File Contents After Checkout Branch
- name: Log JSON File Contents After Checkout
run: |
if [ -f repo_data.json ]; then
echo "Contents of repo_data.json after switching to gh-pages branch:"
cat repo_data.json
else
echo "repo_data.json not found after switching branches."
fi
cat repo_data.json
# Step 7: Commit the JSON file to gh-pages branch
# Step 5: Commit the JSON file to gh-pages branch
- name: Commit JSON File
run: |
if [ -f repo_data.json ]; then
git add repo_data.json
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git commit -m "Update repository languages data [skip ci]" || echo "No changes to commit"
git push origin gh-pages
else
echo "repo_data.json not found, nothing to commit."
git add repo_data.json
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git commit -m "Update repository languages data [skip ci]" || echo "No changes to commit"
git push origin gh-pages

0 comments on commit 0117576

Please sign in to comment.