Skip to content

Commit f4f070f

Browse files
committed
manifest: Auto update PR status
Update status of PR after target tests pass. Signed-off-by: Jorgen Kvalvaag <jorgen.kvalvaag@nordicsemi.no>
1 parent 782876d commit f4f070f

File tree

3 files changed

+48
-29
lines changed

3 files changed

+48
-29
lines changed

.github/workflows/build.yml

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ on:
2828
version:
2929
description: The version of the firmware built on this run_id
3030
value: ${{ jobs.build.outputs.version }}
31+
ncsupdate_pr:
32+
description: Pull request id for west ncs pointer
33+
value: ${{ jobs.build.outputs.ncsupdate_pr }}
3134

3235
pull_request:
3336
paths-ignore:
@@ -47,6 +50,7 @@ jobs:
4750
outputs:
4851
run_id: ${{ github.run_id }}
4952
version: ${{ env.VERSION }}
53+
ncsupdate_pr: ${{ steps.pr.outputs.pull-request-number }}
5054
permissions:
5155
contents: write
5256
pull-requests: write
@@ -78,9 +82,6 @@ jobs:
7882
- name: Install dependencies
7983
run: |
8084
pip install -r nrf/scripts/requirements-build.txt
81-
apt update
82-
apt install -y --no-install-recommends gh
83-
8485
rm -rf artifacts
8586
mkdir -p artifacts
8687
@@ -117,7 +118,8 @@ jobs:
117118
118119
# Asset Tracker Template firmware build
119120
- name: Build thingy91x firmware
120-
uses: ./asset-tracker-template/.github/actions/build-step
121+
#uses: ./asset-tracker-template/.github/actions/build-step
122+
uses: jorgenmk/build@v1
121123
with:
122124
memfault_project_key: ${{ secrets.MEMFAULT_PROJECT_KEY }}
123125
memfault_fw_type: ${{ inputs.memfault_fw_type }}
@@ -132,7 +134,7 @@ jobs:
132134
uses: ./asset-tracker-template/.github/actions/build-step
133135
with:
134136
memfault_project_key: ${{ secrets.MEMFAULT_PROJECT_KEY }}
135-
memfault_fw_type: ${{ inputs.memfault_fw_type }}
137+
memfault_fw_type: ${{ inputs.memfault_fw_type }}
136138
memfault_fw_version_prefix: ${{ env.MEMFAULT_FW_VERSION_PREFIX }}
137139
board: nrf9151dk/nrf9151/ns
138140
short_board: nrf9151dk
@@ -145,13 +147,13 @@ jobs:
145147
uses: ./asset-tracker-template/.github/actions/build-step
146148
with:
147149
memfault_project_key: ${{ secrets.MEMFAULT_PROJECT_KEY }}
148-
memfault_fw_type: ${{ inputs.memfault_fw_type }}
150+
memfault_fw_type: ${{ inputs.memfault_fw_type }}
149151
memfault_fw_version_prefix: ${{ env.MEMFAULT_FW_VERSION_PREFIX }}
150152
board: nrf9151dk/nrf9151/ns
151153
short_board: nrf9151dk
152154
version: ${{ env.VERSION }}
153155
path: asset-tracker-template/app
154-
156+
155157
- name: Upload artifacts
156158
uses: actions/upload-artifact@v4
157159
with:
@@ -163,18 +165,18 @@ jobs:
163165
echo Run id: ${{ github.run_id }}
164166
echo Version: ${{ env.VERSION }}
165167
166-
- name: Auto PR update NCS reference
168+
- name: Create update PR
167169
if: ${{ inputs.nrfsdk_sha_update }}
168-
working-directory: asset-tracker-template
170+
uses: peter-evans/create-pull-request@v7
171+
id: pr
172+
with:
173+
path: asset-tracker-template
174+
add-paths: west.yml
175+
commit-message: "manifest: auto: Update nrf-sdk SHA"
176+
branch: nrf-manifest-auto-branch
177+
base: main
178+
title: "manifest: auto: Update nrf-sdk SHA"
179+
180+
- name: Check outputs
169181
run: |
170-
git config user.name "github-actions[bot]"
171-
git config user.email "github-actions[bot]@users.noreply.github.com"
172-
git add west.yml
173-
git commit -m "manifest: auto: Update nrf-sdk SHA"
174-
git push origin HEAD:nrf-manifest-auto-branch --force
175-
gh pr create --title "manifest: auto: Update nrf-sdk SHA" \
176-
--body "Created by GitHub Action" \
177-
--base main \
178-
--head nrf-manifest-auto-branch || true
179-
env:
180-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
182+
echo PR created: ${{ steps.pr.outputs.pull-request-number }}

.github/workflows/ncsref-update.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,18 @@ jobs:
2424
artifact_run_id: ${{ needs.build.outputs.run_id }}
2525
pytest_marker: not slow
2626
is_scheduled: false
27+
update-pr-state:
28+
needs: [build, test]
29+
runs-on: ubuntu-latest
30+
permissions:
31+
actions: read
32+
contents: write
33+
packages: read
34+
pull-requests: write
35+
steps:
36+
- name: Update PR state
37+
uses: peter-evans/create-or-update-comment@v4
38+
with:
39+
issue-number: ${{ needs.build.outputs.ncsupdate_pr }}
40+
body: |
41+
Tests PASSED on latest ncs SHA :white_check_mark:

.github/workflows/target-test.yml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ on:
2020
type: boolean
2121
required: false
2222
default: false
23+
nrfsdk_sha_update:
24+
type: boolean
25+
required: false
26+
default: false
2327

2428
workflow_dispatch:
2529
inputs:
@@ -54,12 +58,13 @@ jobs:
5458
run: |
5559
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
5660
matrix="${{ github.event.inputs.devices }}"
61+
elif [[ "${{ inputs.is_scheduled }}" == "true" ]]; then
62+
matrix='["thingy91x","nrf9151dk"]'
5763
else
58-
if [[ "${{ inputs.is_scheduled }}" == "true" ]]; then
59-
matrix='["thingy91x","nrf9151dk","ppk_thingy91x"]'
60-
else
61-
matrix='["thingy91x"]'
62-
fi
64+
matrix='["thingy91x"]'
65+
fi
66+
if [[ -z "$matrix" ]]; then
67+
matrix='["thingy91x"]'
6368
fi
6469
6570
echo "Matrix as string: $matrix"
@@ -80,12 +85,10 @@ jobs:
8085
runs-on: cia-trd-${{ matrix.device }}
8186
environment: ${{ matrix.device }}
8287
name: Target Test - ${{ matrix.device }}
83-
8488
permissions:
8589
actions: read
8690
contents: write
8791
packages: read
88-
8992
container:
9093
image: ghcr.io/nrfconnect/asset-tracker-template:test-docker-v1.0.1
9194
options: --privileged
@@ -108,8 +111,7 @@ jobs:
108111
- name: Download artifacts
109112
uses: actions/download-artifact@v4
110113
with:
111-
pattern: firmware-*
112-
merge-multiple: true
114+
name: firmware-artifacts-att
113115
path: asset-tracker-template/tests/on_target/artifacts
114116
run-id: ${{ inputs.artifact_run_id }}
115117
github-token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)