Update Real Remote to Fork #218
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
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 | |
matrix: | |
branch_name: | |
- dunfell | |
- kirkstone | |
- scarthgap | |
- master | |
steps: | |
- name: Checkout main branch | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ matrix.branch_name }} | |
submodules: recursive | |
fetch-depth: 0 | |
- name: Update | |
run: | | |
git fetch -p origin | |
git checkout ${{ matrix.branch_name }} | |
# 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/${{ matrix.branch_name }}..upstream/${{ matrix.branch_name }}; then | |
echo "No changes detected" | |
exit 0 | |
fi | |
git rebase upstream/${{ matrix.branch_name }} | |
- 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 }} | |
Branch: ${{ matrix.branch_name }} | |
${{ 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 }}* | |
Branch: ${{ matrix.branch_name }} | |
${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
<@UCUGH2DGQ> | |
# dennis | |
env: | |
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} |