forked from TimesysGit/meta-timesys
-
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 Github Action to update remote repo
- Loading branch information
1 parent
6366047
commit 0a44f4f
Showing
1 changed file
with
75 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,75 @@ | ||
name: Update Real Remote to Fork | ||
|
||
on: | ||
workflow_dispatch: | ||
schedule: | ||
# run every night @ 01:00 am | ||
- cron: '1 0 * * *' | ||
|
||
jobs: | ||
fetch-updates: | ||
runs-on: ubuntu-latest | ||
environment: upstream-link | ||
strategy: | ||
fail-fast: false | ||
|
||
steps: | ||
- name: Checkout main branch | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: master | ||
submodules: recursive | ||
fetch-depth: 0 | ||
|
||
- name: Update | ||
run: | | ||
git fetch -p origin | ||
git checkout master | ||
# Note: upstream needs to point to the origin repo | ||
git remote add upstream "${{ vars.UPSTREAM_URL }}" | ||
git fetch -p upstream | ||
if git diff --quiet origin/master..upstream/master; then | ||
echo "No changes detected" | ||
exit 0 | ||
fi | ||
git rebase upstream/master | ||
- name: Push Updates | ||
id: push-branch | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "Device Platform GitHub Bot" | ||
git push | ||
- name: Post job success status to slack | ||
if: ${{ success() }} | ||
uses: slackapi/[email protected] | ||
with: | ||
# device-platform-newsfeed | ||
channel-id: 'GQ968L7RC' | ||
# For posting a simple plain text message | ||
slack-message: | | ||
${{ github.repository }}: ${{ github.workflow }}: ${{ job.status }} | ||
${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | ||
env: | ||
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} | ||
|
||
- name: Post job failure status to slack | ||
if: ${{ ! success() }} | ||
uses: slackapi/[email protected] | ||
with: | ||
# device-platform-newsfeed | ||
channel-id: 'GQ968L7RC' | ||
# For posting a simple plain text message | ||
slack-message: | | ||
${{ github.repository }}: ${{ github.workflow }}: *${{ job.status }}* | ||
${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | ||
<@UCUGH2DGQ> <@U040UU3FR28> <@U032H2U0KL5> <@U015UP4P483> | ||
# dennis, ahmad, chinmayi, robert | ||
env: | ||
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} |