From b400f01d24de6ffb2575be663f4843d7931b7b65 Mon Sep 17 00:00:00 2001 From: Timna Brown <24630902+brown9804@users.noreply.github.com> Date: Thu, 17 Jul 2025 07:08:11 -0600 Subject: [PATCH 01/10] testing pipeline --- 0_Azure/README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/0_Azure/README.md b/0_Azure/README.md index a0278dc8e..6c613c9a4 100644 --- a/0_Azure/README.md +++ b/0_Azure/README.md @@ -126,7 +126,9 @@ Last updated: 2025-04-08 image +
-

Total Visitors

- Visitor Count + Total views +

Refresh Date: 2025-07-16

+ From a7423234e2cb5cb80592cc0928f4b09b242300c4 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 17 Jul 2025 13:10:34 +0000 Subject: [PATCH 02/10] Update last modified date in Markdown files --- 0_Azure/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/0_Azure/README.md b/0_Azure/README.md index 6c613c9a4..2c9984f25 100644 --- a/0_Azure/README.md +++ b/0_Azure/README.md @@ -5,7 +5,7 @@ Costa Rica [![GitHub](https://img.shields.io/badge/--181717?logo=github&logoColor=ffffff)](https://github.com/) [brown9804](https://github.com/brown9804) -Last updated: 2025-04-08 +Last updated: 2025-07-17 ------------------------------------------ From 48d6b5a04adf633b31d0aedb57d1ecd891b69e32 Mon Sep 17 00:00:00 2001 From: Timna Brown <24630902+brown9804@users.noreply.github.com> Date: Thu, 17 Jul 2025 07:15:16 -0600 Subject: [PATCH 03/10] preventing local changes overwritten all local changes are staged and committed before any git checkout or branch switching, --- .github/workflows/use-visitor-counter.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/use-visitor-counter.yml b/.github/workflows/use-visitor-counter.yml index d5c9ec139..ba21ca0fe 100644 --- a/.github/workflows/use-visitor-counter.yml +++ b/.github/workflows/use-visitor-counter.yml @@ -57,6 +57,12 @@ jobs: git config --global user.name "github-actions[bot]" git config --global user.email "github-actions[bot]@users.noreply.github.com" + # Pre-commit all changes before any branch switching + - name: Pre-commit local changes + run: | + git add "*.md" metrics.json || true + git commit -m "Save local changes before branch switching" || echo "No changes to commit" + # Commit and push logic for PR events - name: Commit and push changes (PR) if: github.event_name == 'pull_request' @@ -65,10 +71,10 @@ jobs: run: | git fetch origin git checkout ${{ github.head_ref }} + git pull --rebase origin ${{ github.head_ref }} || echo "No rebase needed" git add "*.md" metrics.json git commit -m "Update visitor count" || echo "No changes to commit" git remote set-url origin https://x-access-token:${TOKEN}@github.com/${{ github.repository }} - git pull --rebase origin ${{ github.head_ref }} || echo "No rebase needed" git push origin HEAD:${{ github.head_ref }} # Commit and push logic for non-PR events (schedule, workflow_dispatch) @@ -79,10 +85,10 @@ jobs: run: | git fetch origin git checkout ${{ github.ref_name }} || git checkout -b ${{ github.ref_name }} origin/${{ github.ref_name }} + git pull --rebase origin ${{ github.ref_name }} || echo "No rebase needed" git add "*.md" metrics.json git commit -m "Update visitor count" || echo "No changes to commit" git remote set-url origin https://x-access-token:${TOKEN}@github.com/${{ github.repository }} - git pull --rebase origin ${{ github.ref_name }} || echo "No rebase needed" git push origin HEAD:${{ github.ref_name }} - name: Create Pull Request (non-PR) From cf554511a451c04a580738d56d21fc015034c524 Mon Sep 17 00:00:00 2001 From: Timna Brown <24630902+brown9804@users.noreply.github.com> Date: Thu, 17 Jul 2025 07:24:51 -0600 Subject: [PATCH 04/10] prevents checkout/merge errors) --- .github/workflows/use-visitor-counter.yml | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/.github/workflows/use-visitor-counter.yml b/.github/workflows/use-visitor-counter.yml index ba21ca0fe..a9f21f2d9 100644 --- a/.github/workflows/use-visitor-counter.yml +++ b/.github/workflows/use-visitor-counter.yml @@ -57,13 +57,13 @@ jobs: git config --global user.name "github-actions[bot]" git config --global user.email "github-actions[bot]@users.noreply.github.com" - # Pre-commit all changes before any branch switching + # Pre-commit changes before any branch switching to avoid overwriting local changes - name: Pre-commit local changes run: | git add "*.md" metrics.json || true - git commit -m "Save local changes before branch switching" || echo "No changes to commit" + git commit -m "Auto-commit local changes before branch switch" || echo "No changes to commit" - # Commit and push logic for PR events + # Commit and push logic for PR events (merge, not rebase) - name: Commit and push changes (PR) if: github.event_name == 'pull_request' env: @@ -71,13 +71,13 @@ jobs: run: | git fetch origin git checkout ${{ github.head_ref }} - git pull --rebase origin ${{ github.head_ref }} || echo "No rebase needed" + git pull origin ${{ github.head_ref }} || echo "No merge needed" git add "*.md" metrics.json git commit -m "Update visitor count" || echo "No changes to commit" git remote set-url origin https://x-access-token:${TOKEN}@github.com/${{ github.repository }} git push origin HEAD:${{ github.head_ref }} - # Commit and push logic for non-PR events (schedule, workflow_dispatch) + # Commit and push logic for non-PR events (merge, not rebase) - name: Commit and push changes (non-PR) if: github.event_name != 'pull_request' env: @@ -85,18 +85,8 @@ jobs: run: | git fetch origin git checkout ${{ github.ref_name }} || git checkout -b ${{ github.ref_name }} origin/${{ github.ref_name }} - git pull --rebase origin ${{ github.ref_name }} || echo "No rebase needed" + git pull origin ${{ github.ref_name }} || echo "No merge needed" git add "*.md" metrics.json git commit -m "Update visitor count" || echo "No changes to commit" git remote set-url origin https://x-access-token:${TOKEN}@github.com/${{ github.repository }} git push origin HEAD:${{ github.ref_name }} - - - name: Create Pull Request (non-PR) - if: github.event_name != 'pull_request' - uses: peter-evans/create-pull-request@v6 - with: - token: ${{ secrets.GITHUB_TOKEN }} - branch: update-visitor-count - title: "Update visitor count" - body: "Automated update of visitor count" - base: main From b06db3a337224f33abd8a4e6d006cfaf85fe3248 Mon Sep 17 00:00:00 2001 From: Timna Brown <24630902+brown9804@users.noreply.github.com> Date: Thu, 17 Jul 2025 07:27:41 -0600 Subject: [PATCH 05/10] check out the target branch --- .github/workflows/use-visitor-counter.yml | 42 +++++++++-------------- 1 file changed, 17 insertions(+), 25 deletions(-) diff --git a/.github/workflows/use-visitor-counter.yml b/.github/workflows/use-visitor-counter.yml index a9f21f2d9..90e8af2a5 100644 --- a/.github/workflows/use-visitor-counter.yml +++ b/.github/workflows/use-visitor-counter.yml @@ -57,36 +57,28 @@ jobs: git config --global user.name "github-actions[bot]" git config --global user.email "github-actions[bot]@users.noreply.github.com" - # Pre-commit changes before any branch switching to avoid overwriting local changes - - name: Pre-commit local changes + # Checkout to correct branch before commit + - name: Checkout to correct branch (PR or main) run: | - git add "*.md" metrics.json || true - git commit -m "Auto-commit local changes before branch switch" || echo "No changes to commit" + BRANCH="${{ github.head_ref || github.ref_name }}" + git fetch origin + git checkout "$BRANCH" || git checkout -b "$BRANCH" "origin/$BRANCH" - # Commit and push logic for PR events (merge, not rebase) - - name: Commit and push changes (PR) - if: github.event_name == 'pull_request' - env: - TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Pre-commit local changes run: | - git fetch origin - git checkout ${{ github.head_ref }} - git pull origin ${{ github.head_ref }} || echo "No merge needed" - git add "*.md" metrics.json - git commit -m "Update visitor count" || echo "No changes to commit" - git remote set-url origin https://x-access-token:${TOKEN}@github.com/${{ github.repository }} - git push origin HEAD:${{ github.head_ref }} + # Only add files that exist + [ -f metrics.json ] && git add metrics.json || true + git add "*.md" || true + git commit -m "Auto-commit local changes before pull/merge" || echo "No changes to commit" - # Commit and push logic for non-PR events (merge, not rebase) - - name: Commit and push changes (non-PR) - if: github.event_name != 'pull_request' + - name: Pull (merge) and push changes env: TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - git fetch origin - git checkout ${{ github.ref_name }} || git checkout -b ${{ github.ref_name }} origin/${{ github.ref_name }} - git pull origin ${{ github.ref_name }} || echo "No merge needed" - git add "*.md" metrics.json - git commit -m "Update visitor count" || echo "No changes to commit" + BRANCH="${{ github.head_ref || github.ref_name }}" git remote set-url origin https://x-access-token:${TOKEN}@github.com/${{ github.repository }} - git push origin HEAD:${{ github.ref_name }} + git pull origin "$BRANCH" || echo "No merge needed" + [ -f metrics.json ] && git add metrics.json || true + git add "*.md" || true + git commit -m "Update visitor count" || echo "No changes to commit" + git push origin HEAD:"$BRANCH" From 988acec626c421fce21c2530b5d3d0b32f10735e Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 17 Jul 2025 13:27:55 +0000 Subject: [PATCH 06/10] Auto-commit local changes before pull/merge --- 0_Azure/README.md | 4 +- 1_MS365/Excel/README.md | 4 +- 1_MS365/Forms/README.md | 4 +- 1_MS365/Planner/README.md | 4 +- 1_MS365/README.md | 4 +- 1_MS365/SharePoint/README.md | 4 +- 2_Dynamics365/README.md | 4 +- 3_PowerPlatform/0_PowerApps/README.md | 4 +- 3_PowerPlatform/1_PowerBI/README.md | 4 +- .../2_CopilotStudio/0_DesignCustomCopilots.md | 4 +- 3_PowerPlatform/README.md | 4 +- README.md | 4 +- metrics.json | 37 +++++++++++++++++++ 13 files changed, 61 insertions(+), 24 deletions(-) create mode 100644 metrics.json diff --git a/0_Azure/README.md b/0_Azure/README.md index 2c9984f25..e26d099df 100644 --- a/0_Azure/README.md +++ b/0_Azure/README.md @@ -128,7 +128,7 @@ Last updated: 2025-07-17
- Total views -

Refresh Date: 2025-07-16

+ Total views +

Refresh Date: 2025-07-17

diff --git a/1_MS365/Excel/README.md b/1_MS365/Excel/README.md index 440bcee53..594511d26 100644 --- a/1_MS365/Excel/README.md +++ b/1_MS365/Excel/README.md @@ -30,7 +30,7 @@ Last updated: 2025-07-17
- Total views -

Refresh Date: 2025-07-16

+ Total views +

Refresh Date: 2025-07-17

diff --git a/1_MS365/Forms/README.md b/1_MS365/Forms/README.md index d6dbae1f4..52c1f9d89 100644 --- a/1_MS365/Forms/README.md +++ b/1_MS365/Forms/README.md @@ -29,7 +29,7 @@ Last updated: 2025-07-17
- Total views -

Refresh Date: 2025-07-16

+ Total views +

Refresh Date: 2025-07-17

diff --git a/1_MS365/Planner/README.md b/1_MS365/Planner/README.md index 67028ac22..ce83cb029 100644 --- a/1_MS365/Planner/README.md +++ b/1_MS365/Planner/README.md @@ -31,7 +31,7 @@ Last updated: 2025-07-17
- Total views -

Refresh Date: 2025-07-16

+ Total views +

Refresh Date: 2025-07-17

diff --git a/1_MS365/README.md b/1_MS365/README.md index 109f106d6..8054b9a30 100644 --- a/1_MS365/README.md +++ b/1_MS365/README.md @@ -51,7 +51,7 @@ Last updated: 2025-07-17
- Total views -

Refresh Date: 2025-07-16

+ Total views +

Refresh Date: 2025-07-17

diff --git a/1_MS365/SharePoint/README.md b/1_MS365/SharePoint/README.md index 82b2f1bdb..06fd31109 100644 --- a/1_MS365/SharePoint/README.md +++ b/1_MS365/SharePoint/README.md @@ -33,8 +33,8 @@ Last updated: 2025-07-17
- Total views -

Refresh Date: 2025-07-16

+ Total views +

Refresh Date: 2025-07-17

diff --git a/2_Dynamics365/README.md b/2_Dynamics365/README.md index 2f7d8fb5e..1e24017c5 100644 --- a/2_Dynamics365/README.md +++ b/2_Dynamics365/README.md @@ -31,7 +31,7 @@ Last updated: 2025-07-17
- Total views -

Refresh Date: 2025-07-16

+ Total views +

Refresh Date: 2025-07-17

\ No newline at end of file diff --git a/3_PowerPlatform/0_PowerApps/README.md b/3_PowerPlatform/0_PowerApps/README.md index abfd64c01..18a1aa97e 100644 --- a/3_PowerPlatform/0_PowerApps/README.md +++ b/3_PowerPlatform/0_PowerApps/README.md @@ -38,7 +38,7 @@ formatDateTime(utcNow(), 'MM-dd-yyyy')
- Total views -

Refresh Date: 2025-07-16

+ Total views +

Refresh Date: 2025-07-17

\ No newline at end of file diff --git a/3_PowerPlatform/1_PowerBI/README.md b/3_PowerPlatform/1_PowerBI/README.md index 8eacc98ec..d77f6ef7f 100644 --- a/3_PowerPlatform/1_PowerBI/README.md +++ b/3_PowerPlatform/1_PowerBI/README.md @@ -49,7 +49,7 @@ Last updated: 2025-07-17
- Total views -

Refresh Date: 2025-07-16

+ Total views +

Refresh Date: 2025-07-17

diff --git a/3_PowerPlatform/2_CopilotStudio/0_DesignCustomCopilots.md b/3_PowerPlatform/2_CopilotStudio/0_DesignCustomCopilots.md index 576b544a5..0105f1555 100644 --- a/3_PowerPlatform/2_CopilotStudio/0_DesignCustomCopilots.md +++ b/3_PowerPlatform/2_CopilotStudio/0_DesignCustomCopilots.md @@ -343,7 +343,7 @@ Last updated: 2025-07-17
- Total views -

Refresh Date: 2025-07-16

+ Total views +

Refresh Date: 2025-07-17

diff --git a/3_PowerPlatform/README.md b/3_PowerPlatform/README.md index c6ceb69d3..eb7fd4a67 100644 --- a/3_PowerPlatform/README.md +++ b/3_PowerPlatform/README.md @@ -42,7 +42,7 @@ Explore more on the [Microsoft Power Platform website](https://www.microsoft.com
- Total views -

Refresh Date: 2025-07-16

+ Total views +

Refresh Date: 2025-07-17

diff --git a/README.md b/README.md index d27ea2dd6..1a53b3ca2 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ Last updated: 2025-07-17
- Total views -

Refresh Date: 2025-07-16

+ Total views +

Refresh Date: 2025-07-17

diff --git a/metrics.json b/metrics.json new file mode 100644 index 000000000..86655415d --- /dev/null +++ b/metrics.json @@ -0,0 +1,37 @@ +[ + { + "date": "2025-07-07", + "count": 330, + "uniques": 20 + }, + { + "date": "2025-07-08", + "count": 159, + "uniques": 6 + }, + { + "date": "2025-07-10", + "count": 482, + "uniques": 1 + }, + { + "date": "2025-07-11", + "count": 170, + "uniques": 4 + }, + { + "date": "2025-07-12", + "count": 7, + "uniques": 1 + }, + { + "date": "2025-07-14", + "count": 130, + "uniques": 2 + }, + { + "date": "2025-07-15", + "count": 2, + "uniques": 1 + } +] \ No newline at end of file From 791754a11d8ecc0f8c9085fdea91b2fa919e2408 Mon Sep 17 00:00:00 2001 From: Timna Brown <24630902+brown9804@users.noreply.github.com> Date: Thu, 17 Jul 2025 07:30:16 -0600 Subject: [PATCH 07/10] commit -m changed --- .github/workflows/use-visitor-counter.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/use-visitor-counter.yml b/.github/workflows/use-visitor-counter.yml index 90e8af2a5..b49695797 100644 --- a/.github/workflows/use-visitor-counter.yml +++ b/.github/workflows/use-visitor-counter.yml @@ -69,7 +69,7 @@ jobs: # Only add files that exist [ -f metrics.json ] && git add metrics.json || true git add "*.md" || true - git commit -m "Auto-commit local changes before pull/merge" || echo "No changes to commit" + git commit -m "Automated update of visitor count" || echo "No changes to commit" - name: Pull (merge) and push changes env: From 38e1a287213c85a20cf02067f4b870f8cd5ea50f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 17 Jul 2025 13:30:32 +0000 Subject: [PATCH 08/10] Automated update of visitor count --- 0_Azure/README.md | 2 +- 1_MS365/Excel/README.md | 2 +- 1_MS365/Forms/README.md | 2 +- 1_MS365/Planner/README.md | 2 +- 1_MS365/README.md | 2 +- 1_MS365/SharePoint/README.md | 2 +- 2_Dynamics365/README.md | 2 +- 3_PowerPlatform/0_PowerApps/README.md | 2 +- 3_PowerPlatform/1_PowerBI/README.md | 2 +- 3_PowerPlatform/2_CopilotStudio/0_DesignCustomCopilots.md | 2 +- 3_PowerPlatform/README.md | 2 +- README.md | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/0_Azure/README.md b/0_Azure/README.md index e26d099df..7797308f9 100644 --- a/0_Azure/README.md +++ b/0_Azure/README.md @@ -128,7 +128,7 @@ Last updated: 2025-07-17
- Total views + Total views

Refresh Date: 2025-07-17

diff --git a/1_MS365/Excel/README.md b/1_MS365/Excel/README.md index 594511d26..4b982d5a7 100644 --- a/1_MS365/Excel/README.md +++ b/1_MS365/Excel/README.md @@ -30,7 +30,7 @@ Last updated: 2025-07-17
- Total views + Total views

Refresh Date: 2025-07-17

diff --git a/1_MS365/Forms/README.md b/1_MS365/Forms/README.md index 52c1f9d89..5efa057b2 100644 --- a/1_MS365/Forms/README.md +++ b/1_MS365/Forms/README.md @@ -29,7 +29,7 @@ Last updated: 2025-07-17
- Total views + Total views

Refresh Date: 2025-07-17

diff --git a/1_MS365/Planner/README.md b/1_MS365/Planner/README.md index ce83cb029..5cb0bf0df 100644 --- a/1_MS365/Planner/README.md +++ b/1_MS365/Planner/README.md @@ -31,7 +31,7 @@ Last updated: 2025-07-17
- Total views + Total views

Refresh Date: 2025-07-17

diff --git a/1_MS365/README.md b/1_MS365/README.md index 8054b9a30..10d071e48 100644 --- a/1_MS365/README.md +++ b/1_MS365/README.md @@ -51,7 +51,7 @@ Last updated: 2025-07-17
- Total views + Total views

Refresh Date: 2025-07-17

diff --git a/1_MS365/SharePoint/README.md b/1_MS365/SharePoint/README.md index 06fd31109..e06340498 100644 --- a/1_MS365/SharePoint/README.md +++ b/1_MS365/SharePoint/README.md @@ -33,7 +33,7 @@ Last updated: 2025-07-17
- Total views + Total views

Refresh Date: 2025-07-17

diff --git a/2_Dynamics365/README.md b/2_Dynamics365/README.md index 1e24017c5..0f0eadf73 100644 --- a/2_Dynamics365/README.md +++ b/2_Dynamics365/README.md @@ -31,7 +31,7 @@ Last updated: 2025-07-17
- Total views + Total views

Refresh Date: 2025-07-17

\ No newline at end of file diff --git a/3_PowerPlatform/0_PowerApps/README.md b/3_PowerPlatform/0_PowerApps/README.md index 18a1aa97e..de300483e 100644 --- a/3_PowerPlatform/0_PowerApps/README.md +++ b/3_PowerPlatform/0_PowerApps/README.md @@ -38,7 +38,7 @@ formatDateTime(utcNow(), 'MM-dd-yyyy')
- Total views + Total views

Refresh Date: 2025-07-17

\ No newline at end of file diff --git a/3_PowerPlatform/1_PowerBI/README.md b/3_PowerPlatform/1_PowerBI/README.md index d77f6ef7f..0eb81fe31 100644 --- a/3_PowerPlatform/1_PowerBI/README.md +++ b/3_PowerPlatform/1_PowerBI/README.md @@ -49,7 +49,7 @@ Last updated: 2025-07-17
- Total views + Total views

Refresh Date: 2025-07-17

diff --git a/3_PowerPlatform/2_CopilotStudio/0_DesignCustomCopilots.md b/3_PowerPlatform/2_CopilotStudio/0_DesignCustomCopilots.md index 0105f1555..fea10a690 100644 --- a/3_PowerPlatform/2_CopilotStudio/0_DesignCustomCopilots.md +++ b/3_PowerPlatform/2_CopilotStudio/0_DesignCustomCopilots.md @@ -343,7 +343,7 @@ Last updated: 2025-07-17
- Total views + Total views

Refresh Date: 2025-07-17

diff --git a/3_PowerPlatform/README.md b/3_PowerPlatform/README.md index eb7fd4a67..cd53cd546 100644 --- a/3_PowerPlatform/README.md +++ b/3_PowerPlatform/README.md @@ -42,7 +42,7 @@ Explore more on the [Microsoft Power Platform website](https://www.microsoft.com
- Total views + Total views

Refresh Date: 2025-07-17

diff --git a/README.md b/README.md index 1a53b3ca2..fd3ba373e 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ Last updated: 2025-07-17
- Total views + Total views

Refresh Date: 2025-07-17

From 8602268b8fdcbd03870dc46608d58d62841926ce Mon Sep 17 00:00:00 2001 From: Timna Brown <24630902+brown9804@users.noreply.github.com> Date: Thu, 17 Jul 2025 07:36:09 -0600 Subject: [PATCH 09/10] current branch --- .github/workflows/update-md-date.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/update-md-date.yml b/.github/workflows/update-md-date.yml index ac7a96d4b..5b2a19b9a 100644 --- a/.github/workflows/update-md-date.yml +++ b/.github/workflows/update-md-date.yml @@ -14,10 +14,11 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout repository + - name: Checkout PR branch uses: actions/checkout@v4 with: fetch-depth: 0 + ref: ${{ github.event.pull_request.head.ref }} - name: Set up Python uses: actions/setup-python@v4 @@ -35,13 +36,13 @@ jobs: - name: Update last modified date in Markdown files run: python .github/workflows/update_date.py - - name: Commit changes + - name: Pull (merge) remote changes, commit, and push if needed env: TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - git fetch origin ${{ github.event.pull_request.head.ref }} - git pull --rebase origin ${{ github.event.pull_request.head.ref }} || echo "No rebase needed" + BRANCH="${{ github.event.pull_request.head.ref }}" + git pull origin "$BRANCH" || echo "No merge needed" git add -A git commit -m "Update last modified date in Markdown files" || echo "No changes to commit" git remote set-url origin https://x-access-token:${TOKEN}@github.com/${{ github.repository }} - git push origin HEAD:${{ github.event.pull_request.head.ref }} + git push origin HEAD:"$BRANCH" From d13b950bcd5019f5e8db7a0e18a0b67d046299a3 Mon Sep 17 00:00:00 2001 From: Timna Brown <24630902+brown9804@users.noreply.github.com> Date: Thu, 17 Jul 2025 07:39:55 -0600 Subject: [PATCH 10/10] parallel processing Uses git pull (merge) instead of git pull --rebase to support parallel pipelines. --- .github/workflows/use-visitor-counter.yml | 36 +++++++++++++---------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/.github/workflows/use-visitor-counter.yml b/.github/workflows/use-visitor-counter.yml index b49695797..90c4b1f85 100644 --- a/.github/workflows/use-visitor-counter.yml +++ b/.github/workflows/use-visitor-counter.yml @@ -57,28 +57,32 @@ jobs: git config --global user.name "github-actions[bot]" git config --global user.email "github-actions[bot]@users.noreply.github.com" - # Checkout to correct branch before commit - - name: Checkout to correct branch (PR or main) + # Commit and push logic for PR events (merge, not rebase) + - name: Commit and push changes (PR) + if: github.event_name == 'pull_request' + env: + TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - BRANCH="${{ github.head_ref || github.ref_name }}" git fetch origin - git checkout "$BRANCH" || git checkout -b "$BRANCH" "origin/$BRANCH" - - - name: Pre-commit local changes - run: | - # Only add files that exist - [ -f metrics.json ] && git add metrics.json || true + git checkout ${{ github.head_ref }} + git pull origin ${{ github.head_ref }} || echo "No merge needed" git add "*.md" || true - git commit -m "Automated update of visitor count" || echo "No changes to commit" + [ -f metrics.json ] && git add metrics.json || true + git commit -m "Update visitor count" || echo "No changes to commit" + git remote set-url origin https://x-access-token:${TOKEN}@github.com/${{ github.repository }} + git push origin HEAD:${{ github.head_ref }} - - name: Pull (merge) and push changes + # Commit and push logic for non-PR events (merge, not rebase) + - name: Commit and push changes (non-PR) + if: github.event_name != 'pull_request' env: TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - BRANCH="${{ github.head_ref || github.ref_name }}" - git remote set-url origin https://x-access-token:${TOKEN}@github.com/${{ github.repository }} - git pull origin "$BRANCH" || echo "No merge needed" - [ -f metrics.json ] && git add metrics.json || true + git fetch origin + git checkout ${{ github.ref_name }} || git checkout -b ${{ github.ref_name }} origin/${{ github.ref_name }} + git pull origin ${{ github.ref_name }} || echo "No merge needed" git add "*.md" || true + [ -f metrics.json ] && git add metrics.json || true git commit -m "Update visitor count" || echo "No changes to commit" - git push origin HEAD:"$BRANCH" + git remote set-url origin https://x-access-token:${TOKEN}@github.com/${{ github.repository }} + git push origin HEAD:${{ github.ref_name }}