Skip to content

Commit 8feb767

Browse files
Timna BrownTimna Brown
authored andcommitted
fix: serialize workflow branch updates
1 parent 3cd23ec commit 8feb767

6 files changed

Lines changed: 94 additions & 28 deletions

File tree

.github/workflows/update-md-date.yml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ on:
55
branches:
66
- main
77

8+
concurrency:
9+
group: pr-branch-maintenance-${{ github.event.pull_request.head.ref || github.ref_name }}
10+
cancel-in-progress: false
11+
812
permissions:
913
contents: write
1014
pull-requests: write
@@ -43,8 +47,19 @@ jobs:
4347
TOKEN: ${{ secrets.GITHUB_TOKEN }}
4448
run: |
4549
BRANCH="${{ github.event.pull_request.head.ref }}"
46-
git pull origin "$BRANCH" || echo "No merge needed"
4750
git add -A
48-
git commit -m "Update last modified date in Markdown files" || echo "No changes to commit"
51+
if git diff --staged --quiet; then
52+
echo "No changes to commit"
53+
exit 0
54+
fi
55+
git commit -m "Update last modified date in Markdown files"
4956
git remote set-url origin https://x-access-token:${TOKEN}@github.com/${{ github.repository }}
50-
git push origin HEAD:"$BRANCH"
57+
for attempt in 1 2 3; do
58+
git fetch origin "$BRANCH"
59+
git rebase "origin/$BRANCH"
60+
if git push origin HEAD:"$BRANCH"; then
61+
exit 0
62+
fi
63+
done
64+
echo "Failed to push branch updates after 3 attempts."
65+
exit 1

.github/workflows/use-visitor-counter.yml

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ on:
66
- main
77
workflow_dispatch:
88

9+
concurrency:
10+
group: pr-branch-maintenance-${{ github.event.pull_request.head.ref || github.ref_name }}
11+
cancel-in-progress: false
12+
913
permissions:
1014
contents: write
1115
pull-requests: write
@@ -40,13 +44,26 @@ jobs:
4044
- name: Commit and merge changes
4145
env:
4246
PR_BRANCH: ${{ github.head_ref || github.ref_name }}
47+
TOKEN: ${{ secrets.GITHUB_TOKEN }}
4348
GIT_AUTHOR_NAME: github-actions[bot]
4449
GIT_AUTHOR_EMAIL: github-actions[bot]@users.noreply.github.com
4550
GIT_COMMITTER_NAME: github-actions[bot]
4651
GIT_COMMITTER_EMAIL: github-actions[bot]@users.noreply.github.com
4752
run: |
4853
git switch -c "$PR_BRANCH" || git switch "$PR_BRANCH"
4954
git add -A
50-
git diff --staged --quiet || git commit -m "Update visitor count"
51-
git pull origin "$PR_BRANCH" --no-rebase || echo "No merge needed"
52-
git push origin "$PR_BRANCH"
55+
if git diff --staged --quiet; then
56+
echo "No changes to commit"
57+
exit 0
58+
fi
59+
git commit -m "Update visitor count"
60+
git remote set-url origin https://x-access-token:${TOKEN}@github.com/${{ github.repository }}
61+
for attempt in 1 2 3; do
62+
git fetch origin "$PR_BRANCH"
63+
git rebase "origin/$PR_BRANCH"
64+
if git push origin HEAD:"$PR_BRANCH"; then
65+
exit 0
66+
fi
67+
done
68+
echo "Failed to push branch updates after 3 attempts."
69+
exit 1

.github/workflows/validate_and_fix_markdown.yml

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ on:
55
branches:
66
- main
77

8+
concurrency:
9+
group: pr-branch-maintenance-${{ github.event.pull_request.head.ref || github.ref_name }}
10+
cancel-in-progress: false
11+
812
permissions:
913
contents: write
1014
pull-requests: write
@@ -48,11 +52,24 @@ jobs:
4852
- name: Commit and rebase changes
4953
env:
5054
PR_BRANCH: ${{ github.head_ref || github.ref_name }}
55+
TOKEN: ${{ secrets.GITHUB_TOKEN }}
5156
run: |
5257
git add -A
53-
git commit -m "Fix Markdown syntax issues" || echo "No changes to commit"
54-
git pull --rebase origin "$PR_BRANCH" || echo "No rebase needed"
55-
git push origin HEAD:"$PR_BRANCH"
58+
if git diff --staged --quiet; then
59+
echo "No changes to commit"
60+
exit 0
61+
fi
62+
git commit -m "Fix Markdown syntax issues"
63+
git remote set-url origin https://x-access-token:${TOKEN}@github.com/${{ github.repository }}
64+
for attempt in 1 2 3; do
65+
git fetch origin "$PR_BRANCH"
66+
git rebase "origin/$PR_BRANCH"
67+
if git push origin HEAD:"$PR_BRANCH"; then
68+
exit 0
69+
fi
70+
done
71+
echo "Failed to push branch updates after 3 attempts."
72+
exit 1
5673
5774
- name: Fail if standard Markdown header validation failed
5875
if: steps.validate-header.outcome == 'failure'

.github/workflows/validate_and_fix_notebook.yml

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,13 @@ on:
55
branches:
66
- main
77

8+
concurrency:
9+
group: pr-branch-maintenance-${{ github.event.pull_request.head.ref || github.ref_name }}
10+
cancel-in-progress: false
11+
812
permissions:
913
contents: write
14+
pull-requests: write
1015

1116
jobs:
1217
validate-and-fix-notebook:
@@ -60,10 +65,23 @@ jobs:
6065
git config --global user.name "github-actions[bot]"
6166
6267
- name: Commit changes
68+
env:
69+
PR_BRANCH: ${{ github.event.pull_request.head.ref }}
70+
TOKEN: ${{ secrets.GITHUB_TOKEN }}
6371
run: |
64-
git fetch origin
65-
git checkout -B "${{ github.event.pull_request.head.ref }}" "origin/${{ github.event.pull_request.head.ref }}"
6672
git add -A
67-
git commit -m "Fix notebook format issues" || echo "No changes to commit"
68-
git pull --rebase origin "${{ github.event.pull_request.head.ref }}" || echo "No rebase needed"
69-
git push origin HEAD:"${{ github.event.pull_request.head.ref }}"
73+
if git diff --staged --quiet; then
74+
echo "No changes to commit"
75+
exit 0
76+
fi
77+
git commit -m "Fix notebook format issues"
78+
git remote set-url origin https://x-access-token:${TOKEN}@github.com/${{ github.repository }}
79+
for attempt in 1 2 3; do
80+
git fetch origin "$PR_BRANCH"
81+
git rebase "origin/$PR_BRANCH"
82+
if git push origin HEAD:"$PR_BRANCH"; then
83+
exit 0
84+
fi
85+
done
86+
echo "Failed to push branch updates after 3 attempts."
87+
exit 1

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ Last updated: 2025-02-21
1010
----------
1111

1212
> Provides an example of creating an automated file processing and summary generation tool using Microsoft Azure technologies. It demonstrates how to use Azure AI Services, Azure Blob Storage, Azure Functions, and Python to upload files, search for key values, and generate summaries. The tool supports tabular data in xlsx and csv formats, as well as text data from docs and pdf files. Summaries can be generated in few formats, including xlsx, csv, and text files.
13-
1413
> [!IMPORTANT]
1514
> Disclaimer: Please note, this example of solution `it is not an official solution guide`. For official guidance, support, or more detailed information, please refer to Microsoft's official documentation or contact Microsoft directly: [Microsoft Sales and Support](https://support.microsoft.com/contactus?ContactUsExperienceEntryPointAssetId=S.HP.SMC-HOME)
1615

terraform/README.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Last updated: 2025-02-21
2727

2828
## Overview
2929

30-
```
30+
```text
3131
.
3232
├── README.md
3333
├── src
@@ -48,20 +48,20 @@ Last updated: 2025-02-21
4848

4949
## Resources
5050

51-
| Resource | Description |
52-
|---------------------------|-------------------------------------------------------------------------------------------------------|
53-
| Azure Resource Group | A logical container that organizes and manages all the related Azure resources. |
54-
| Azure Blob Storage | Stores input files (xlsx, csv, docs, pdfs) and output summary files. |
55-
| Azure Functions | Executes serverless compute tasks to process the uploaded files and generate summaries. |
56-
| Azure AI Services | Provides text analytics and OCR capabilities to handle text data from docs and pdfs. |
57-
| Azure Storage Account | Manages Blob Storage and other storage services. |
58-
| Azure Key Vault | Stores and manages sensitive information such as connection strings and API keys. |
59-
| Application Insights | Monitors the performance and usage of the file processing tool. |
60-
| Log Analytics Workspace | Collects and analyzes log data from various sources. |
51+
| Resource | Description |
52+
| :---------------------- | :-------------------------------------------------------------------------------------------- |
53+
| Azure Resource Group | A logical container that organizes and manages all the related Azure resources. |
54+
| Azure Blob Storage | Stores input files (xlsx, csv, docs, pdfs) and output summary files. |
55+
| Azure Functions | Executes serverless compute tasks to process the uploaded files and generate summaries. |
56+
| Azure AI Services | Provides text analytics and OCR capabilities to handle text data from docs and pdfs. |
57+
| Azure Storage Account | Manages Blob Storage and other storage services. |
58+
| Azure Key Vault | Stores and manages sensitive information such as connection strings and API keys. |
59+
| Application Insights | Monitors the performance and usage of the file processing tool. |
60+
| Log Analytics Workspace | Collects and analyzes log data from various sources. |
6161

6262
## How to execute it
6363

64-
```mermaid
64+
```mermaid
6565
graph TD;
6666
A[az login] --> B(terraform init)
6767
B --> C{Terraform provisioning stage}
@@ -90,7 +90,7 @@ graph TD;
9090

9191
2. **Initialize Terraform**: Initializes the working directory containing the Terraform configuration files. It downloads the necessary provider plugins and sets up the backend for storing the state.
9292

93-
``` sh
93+
```sh
9494
terraform init
9595
```
9696

0 commit comments

Comments
 (0)