Skip to content

Commit 015ec32

Browse files
Merge branch 'master' into update-oauth2
2 parents baf572c + 9d804a2 commit 015ec32

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

.github/workflows/sync_upstream.yaml

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# for reference: https://stackoverflow.com/questions/23793062/can-forks-be-synced-automatically-in-github
2+
# .github/workflows/example.yml
3+
4+
name: Sync upstream oauth2 repo
5+
6+
on:
7+
workflow_dispatch:
8+
schedule:
9+
- cron: '0 9 * * 1'
10+
# run once a week on monday morning
11+
# if it fails
12+
# send slack message (iw-engineering or integration-inovators)
13+
14+
15+
permissions:
16+
contents: write
17+
18+
jobs:
19+
merge:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v4
23+
- name: Merge upstream
24+
run: |
25+
git config --global user.name 'upstream-sync-bot'
26+
git config --global user.email '[email protected]'
27+
git config --global push.followTags true
28+
29+
git pull
30+
31+
git remote add upstream https://github.com/golang/oauth2.git
32+
git fetch --tags upstream
33+
34+
git checkout master
35+
git merge --allow-unrelated-histories --no-edit upstream/master
36+
git push origin master
37+
38+
- name: On Fail, Send Message About Merge to Slack
39+
if: ${{ failure() }}
40+
uses: archive/[email protected]
41+
id: notify-slack
42+
env:
43+
ACTIONS_STEP_DEBUG: true
44+
ACTIONS_RUNNER_DEBUG: true
45+
with:
46+
slack-bot-user-oauth-access-token: ${{ secrets.SLACK_BOT_TOKEN }}
47+
slack-channel: ${{ secrets.SLACK_BOT_INTEGRATION_INNOVATORS_CHANNEL }} #USE CHANNEL ID, NOT CHANNEL NAME, SINCE ID IS USED IN NEW SLACK API's
48+
slack-text: |
49+
OAuth2 fork upstream sync failed. [action](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
50+
51+
- name: Send Slack Message Result
52+
if: ${{ failure() }}
53+
run: echo "${{ steps.notify-slack.outputs.slack-result }}"

0 commit comments

Comments
 (0)