Skip to content

Commit 79d69a4

Browse files
Action workflow
1 parent d4f28cb commit 79d69a4

3 files changed

Lines changed: 96 additions & 1 deletion

File tree

.github/sharepoint-sync.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# SharePoint Document Sync — Repository Configuration
2+
# See: specs/sharepoint-document-sync-action.md
3+
4+
# Folder in the repository to sync to SharePoint
5+
source_folder: "docs"
6+
7+
# SENSITIVE INFORMATION: SharePoint Online site URL — reveals internal tenant/site name.
8+
# Replace with your own site. Do NOT commit production URLs to public repositories.
9+
sharepoint_site: "phoenixdevelopments.sharepoint.com:/sites/BCTechDays2026"
10+
11+
# SENSITIVE INFORMATION: Target folder path — reveals internal document library structure.
12+
# Path is relative to the drive root (the "Documents" library). Do NOT include
13+
# "Shared Documents" — the default drive already points to that library.
14+
sharepoint_folder: "/BC-Tech-Days-26"
15+
16+
# Whether to delete files from SharePoint that no longer exist in the source folder
17+
# false = additive-only sync (never deletes from SharePoint)
18+
delete_orphaned: false
19+
20+
# Delta detection mode:
21+
# "auto" — uses git-diff when SHAs are available, falls back to full scan
22+
# "git-diff" — only sync files changed between base and head commits (fast)
23+
# "full" — scan and upload all matching files every time (reliable)
24+
sync_mode: "auto"
25+
26+
# Optional: only sync files matching these glob patterns
27+
# If omitted, all files in source_folder are synced
28+
# file_patterns:
29+
# - "**/*.md"
30+
# - "**/*.pdf"
31+
# - "**/*.docx"
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: SharePoint Document Sync
2+
3+
on:
4+
push:
5+
branches: [main]
6+
workflow_dispatch:
7+
inputs:
8+
sync_mode:
9+
description: "Sync mode override (full = upload all files, auto = git-diff)"
10+
required: false
11+
default: "full"
12+
type: choice
13+
options:
14+
- full
15+
- auto
16+
17+
permissions:
18+
id-token: write # Required for OIDC token exchange
19+
contents: read # Required to read repo files
20+
21+
env:
22+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
23+
24+
jobs:
25+
sync:
26+
name: Sync documents to SharePoint
27+
runs-on: ubuntu-latest
28+
29+
steps:
30+
- name: Checkout repository
31+
uses: actions/checkout@v4
32+
with:
33+
fetch-depth: 0 # Full history for git-diff delta detection
34+
35+
- name: Determine merge base
36+
id: merge-base
37+
run: |
38+
# If manually triggered with "full" mode, skip SHA detection
39+
if [ "${{ github.event.inputs.sync_mode }}" = "full" ]; then
40+
echo "base-sha=" >> "$GITHUB_OUTPUT"
41+
echo "head-sha=" >> "$GITHUB_OUTPUT"
42+
else
43+
BASE_SHA=$(git rev-parse HEAD~1 2>/dev/null || echo "")
44+
HEAD_SHA=$(git rev-parse HEAD)
45+
echo "base-sha=${BASE_SHA}" >> "$GITHUB_OUTPUT"
46+
echo "head-sha=${HEAD_SHA}" >> "$GITHUB_OUTPUT"
47+
fi
48+
49+
# SENSITIVE INFORMATION: AZURE_CLIENT_ID and AZURE_TENANT_ID are stored as
50+
# GitHub Encrypted Secrets. They are UUIDs (not credentials), but reveal
51+
# infrastructure identity. Never hardcode them — always reference via secrets.
52+
- name: Azure Login (OIDC)
53+
uses: azure/login@v2
54+
with:
55+
client-id: ${{ secrets.AZURE_CLIENT_ID }} # SENSITIVE INFORMATION: App Registration Client ID
56+
tenant-id: ${{ secrets.AZURE_TENANT_ID }} # SENSITIVE INFORMATION: Entra ID Tenant ID
57+
allow-no-subscriptions: true
58+
59+
- name: Sync to SharePoint
60+
uses: ./actions/sharepoint-sync
61+
with:
62+
config-path: .github/sharepoint-sync.yml
63+
base-sha: ${{ steps.merge-base.outputs.base-sha }}
64+
head-sha: ${{ steps.merge-base.outputs.head-sha }}

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ rad.json
2222
#Test results file
2323
TestResults.xml
2424
#Github
25-
.github/
25+
#.github/
2626
#Claude
2727
.claude/
2828
#al Test Runner

0 commit comments

Comments
 (0)