FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
github-docs/.github/workflows/site-policy-sync.yml at main · coolaj86/github-docs · GitHub
coolaj86
/
github-docs
Public
forked from
github/docs
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
github-docs
/
.github
/
workflows
/
site-policy-sync.yml
Copy path
View runs
More file actions
More file actions
Latest commit
History
History
History
69 lines (62 loc) · 2.5 KB
Breadcrumbs
github-docs
/
.github
/
workflows
/
site-policy-sync.yml
Copy path
File metadata and controls
69 lines (62 loc) · 2.5 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
name
:
Site policy sync
#
**What it does**: Creates a branch in our site-policy repo with changes to site policy docs.
#
**Why we have it**: We want to keep the site-policy repo up to date.
#
**Who does it impact**: site-policy-admins and Developer Policy teams.
#
Controls when the action will run.
on
:
#
Triggers the workflow pull requests merged to the main branch
pull_request
:
branches
:
-
main
types
:
-
closed
paths
:
-
'
content/site-policy/**
'
workflow_dispatch
:
permissions
:
contents
:
read
jobs
:
sync
:
name
:
Get the latest docs
if
:
github.event_name == 'workflow_dispatch' || (github.event.pull_request.merged == true && github.repository == 'github/docs-internal')
runs-on
:
ubuntu-latest
steps
:
-
name
:
checkout docs-internal
uses
:
actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
-
name
:
checkout public site-policy
uses
:
actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
with
:
repository
:
github/site-policy
token
:
${{ secrets.API_TOKEN_SITEPOLICY }}
fetch-depth
:
'
'
path
:
public-repo
-
name
:
Commits internal policies to copy of public repo with descriptive message from triggering PR title
env
:
PR_TITLE
:
${{ github.event.pull_request.title }}
run
:
|
cd public-repo
git config --local user.name 'site-policy-bot'
git config --local user.email 'site-policy-bot@github.com'
rm -rf Policies
cp -r ../content/site-policy Policies
git status
git checkout -b automated-sync-$GITHUB_RUN_ID
git add .
echo PR_TITLE: $PR_TITLE
[[ ! -z $PR_TITLE ]] && DESCRIPTION="${PR_TITLE}" || DESCRIPTION="Update manually triggered by workflow"
echo "DESCRIPTION=$DESCRIPTION" >> $GITHUB_ENV
git commit -m "$(echo $DESCRIPTION)"
-
name
:
If there are changes to push, create a branch in the public repo and push changes
env
:
GITHUB_TOKEN
:
${{ secrets.DOCS_BOT_PAT_READPUBLICKEY }}
run
:
|
cd public-repo
git config --local user.name 'site-policy-bot'
git config --local user.email 'site-policy-bot@github.com'
NUM_FILES_CHANGED=$(git diff --name-only HEAD^..HEAD | wc -l)
if [[ $NUM_FILES_CHANGED -ge 1 ]]
then
git push --set-upstream origin automated-sync-$GITHUB_RUN_ID
else
echo "No updates to push to the public repo"
fi
Back
|
FazBrowse Home
|
New Git URL