Skip to content

Commit b9c4cb3

Browse files
authored
Merge pull request #2 from pulumi/sean/add-upstream-sync-job
add upstream sync job
2 parents 7332e1b + c44066e commit b9c4cb3

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: "Scheduled Jobs: Upstream Sync"
2+
3+
on:
4+
schedule:
5+
- cron: 0/15 * * * *
6+
workflow_dispatch:
7+
8+
jobs:
9+
sync_latest_from_upstream:
10+
# Only run this job for events that originate on downstream repos.
11+
if: github.repository != 'pulumi/docs'
12+
runs-on: ubuntu-latest
13+
name: Sync latest commits from upstream repo
14+
15+
steps:
16+
- name: Checkout target repo
17+
uses: actions/checkout@v2
18+
with:
19+
ref: master
20+
token: ${{ secrets.PULUMI_BOT_TOKEN }}
21+
22+
- name: Sync upstream changes
23+
id: sync
24+
uses: aormsby/[email protected]
25+
with:
26+
upstream_sync_repo: pulumi/docs
27+
upstream_sync_branch: master
28+
target_sync_branch: master
29+
target_repo_token: ${{ secrets.GITHUB_TOKEN }}
30+
31+
- name: New commits found
32+
if: steps.sync.outputs.has_new_commits == 'true'
33+
run: echo "New commits were found to sync."
34+
35+
- name: No new commits
36+
if: steps.sync.outputs.has_new_commits == 'false'
37+
run: echo "There were no new commits."
38+
39+
- name: Show value of 'has_new_commits'
40+
run: echo ${{ steps.sync.outputs.has_new_commits }}
41+
42+
notify:
43+
if: failure()
44+
name: Send slack notification
45+
runs-on: ubuntu-latest
46+
needs: [sync_latest_from_upstream]
47+
steps:
48+
- name: Slack Notification
49+
uses: docker://sholung/action-slack-notify:v2.3.0
50+
env:
51+
SLACK_CHANNEL: docs-ops
52+
SLACK_COLOR: "#F54242"
53+
SLACK_MESSAGE: "upstream sync failure in docs private repo :meow_sad:"
54+
SLACK_USERNAME: docs-private-bot
55+
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
56+
SLACK_ICON: https://www.pulumi.com/logos/brand/avatar-on-white.png

0 commit comments

Comments
 (0)