Skip to content
This repository has been archived by the owner on Jul 9, 2024. It is now read-only.

Update application source code from nRF Connect SDK #923

Update application source code from nRF Connect SDK

Update application source code from nRF Connect SDK #923

name: Update application source code from nRF Connect SDK
on:
schedule:
- cron: "0 0 * * *"
push:
paths:
- ".github/workflows/update-from-ncs.yaml"
workflow_dispatch:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CI_GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }}
jobs:
update:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4
- name: Remove upstream files
run: rm -rf ./{src,boards,child_image,tests}
- name: Update from upstream
run: |
git clone --single-branch --branch main https://github.com/nrfconnect/sdk-nrf sdk-nrf
cp -rv sdk-nrf/applications/asset_tracker_v2/* ./
echo "UPSTREAM_REV=`git -C sdk-nrf rev-parse HEAD | tr -d '\n'`" >> $GITHUB_ENV
rm -rf sdk-nrf
- name: Check if changes were made
run: |
git status
if [[ `git status --porcelain` ]]; then
echo "HAS_CHANGES=1" >> $GITHUB_ENV
else
echo "HAS_CHANGES=0" >> $GITHUB_ENV
fi
- name: Commit update
if: env.HAS_CHANGES == '1'
run: |
echo "machine github.com login accesskey password ${GITHUB_TOKEN}" > ~/.netrc
git config --global user.email "[email protected]"
git config --global user.name "github-actions[bot]"
git add -A
git commit -m "fix: update from upstream
See https://github.com/nrfconnect/sdk-nrf/tree/${{ env.UPSTREAM_REV }}/applications/asset_tracker_v2"
git pull --rebase
git push
- name: Trigger build
if: env.HAS_CHANGES == '1'
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.CI_GITHUB_TOKEN }}
event-type: source-update