-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add workflow to update storage account table
- Loading branch information
1 parent
f689761
commit 7230552
Showing
2 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: Update redirects uri table | ||
|
||
on: | ||
push: | ||
paths: | ||
- shorts.csv # Trigger the workflow when this file is modified | ||
|
||
permissions: | ||
id-token: write | ||
contents: read | ||
|
||
jobs: | ||
update_table: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Azure login | ||
uses: azure/login@v2 | ||
with: | ||
client-id: ${{ secrets.AZURE_CLIENT_ID }} | ||
tenant-id: ${{ secrets.AZURE_TENANT_ID }} | ||
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | ||
|
||
- name: Install Azure CLI Storage Table extension | ||
run: | | ||
az extension add --name storage-preview | ||
- name: Update Azure Table with CSV Data | ||
run: | | ||
# Read the CSV and iterate over each line (skipping header) | ||
while IFS=, read -r short_path redirect_uri title; do | ||
# Skip header | ||
if [ "$short_path" != "ShortPath" ]; then | ||
echo "Processing: ShortPath=$short_path, RedirectUri=$redirect_uri, Title=$title" | ||
# Insert or update the entity in Azure Table Storage | ||
az storage entity insert \ | ||
--auth-mode login \ | ||
--account-name ${{ secrets.STORAGE_ACCOUNT_NAME }} \ | ||
--table-name ${{ secrets.STORAGE_TABLE_NAME }} \ | ||
--entity PartitionKey="${short_path:0:1}" RowKey="$short_path" Url="$redirect_uri" Title="$title" \ | ||
--if-exists replace | ||
fi | ||
done < shorts.csv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
ShortPath,RedirectUri,Title | ||
xms,https://xebia.com/digital-transformation/microsoft-services/,Xebia Microsoft services |