Skip to content

Commit 471418a

Browse files
authored
Switch to variant of "Compile Examples" workflow for public repos (#56)
Initial development of the project was done in a private repository. In that environment, the most efficient configuration of the workflow is done by running the `arduino/report-size-deltas` action from a job in the same workflow. However, that configuration is not suitable for use in a public repository. The reason is that the deltas report comment requires a GitHub access token with write permissions and the token does not have such permissions when the "Compile Examples" workflow is triggered by events in a pull request from a fork. For this reason, it is necessary to run the `arduino/report-size-deltas` action from a dedicated scheduled workflow, which will always have write permissions.
1 parent c0bf20c commit 471418a

File tree

3 files changed

+28
-28
lines changed

3 files changed

+28
-28
lines changed

.github/workflows/compile-examples-private.yml renamed to .github/workflows/compile-examples.yml

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ name: Compile Examples
44
on:
55
push:
66
paths:
7-
- ".github/workflows/compile-examples-private.ya?ml"
7+
- ".github/workflows/compile-examples.ya?ml"
88
- "library.properties"
99
- "examples/**"
1010
- "src/**"
1111
pull_request:
1212
paths:
13-
- ".github/workflows/compile-examples-private.ya?ml"
13+
- ".github/workflows/compile-examples.ya?ml"
1414
- "library.properties"
1515
- "examples/**"
1616
- "src/**"
@@ -22,8 +22,6 @@ on:
2222

2323
env:
2424
SKETCHES_REPORTS_PATH: sketches-reports
25-
SKETCHES_REPORTS_ARTIFACT_NAME: sketches-reports
26-
2725
jobs:
2826
build:
2927
name: ${{ matrix.board.fqbn }}
@@ -65,26 +63,4 @@ jobs:
6563
with:
6664
if-no-files-found: error
6765
path: ${{ env.SKETCHES_REPORTS_PATH }}
68-
name: ${{ env.SKETCHES_REPORTS_ARTIFACT_NAME }}
69-
70-
report-size-deltas:
71-
needs: build
72-
# Run even if some compilations failed.
73-
if: always() && github.event_name == 'pull_request'
74-
runs-on: ubuntu-latest
75-
76-
steps:
77-
- name: Download sketches reports artifact
78-
id: download-artifact
79-
continue-on-error: true # If compilation failed for all boards then there are no artifacts
80-
uses: actions/download-artifact@v2
81-
with:
82-
name: ${{ env.SKETCHES_REPORTS_ARTIFACT_NAME }}
83-
path: ${{ env.SKETCHES_REPORTS_PATH }}
84-
85-
- name: Comment size deltas report to PR
86-
uses: arduino/report-size-deltas@v1
87-
# If actions/download-artifact failed, there are no artifacts to report from.
88-
if: steps.download-artifact.outcome == 'success'
89-
with:
90-
sketches-reports-source: ${{ env.SKETCHES_REPORTS_PATH }}
66+
name: ${{ env.SKETCHES_REPORTS_PATH }}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Report Size Deltas
2+
3+
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
4+
on:
5+
push:
6+
paths:
7+
- ".github/workflows/report-size-deltas.ya?ml"
8+
schedule:
9+
# Run at the minimum interval allowed by GitHub Actions.
10+
# Note: GitHub Actions periodically has outages which result in workflow failures.
11+
# In this event, the workflows will start passing again once the service recovers.
12+
- cron: "*/5 * * * *"
13+
workflow_dispatch:
14+
repository_dispatch:
15+
16+
jobs:
17+
report:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Comment size deltas reports to PRs
21+
uses: arduino/report-size-deltas@v1
22+
with:
23+
# The name of the workflow artifact created by the sketch compilation workflow
24+
sketches-reports-source: sketches-reports

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
==========================
55

66
[![Check Arduino status](https://github.com/arduino-libraries/Arduino_Braccio_plusplus/actions/workflows/check-arduino.yml/badge.svg)](https://github.com/arduino-libraries/Arduino_Braccio_plusplus/actions/workflows/check-arduino.yml)
7-
[![Compile Examples status](https://github.com/arduino-libraries/Arduino_Braccio_plusplus/actions/workflows/compile-examples-private.yml/badge.svg)](https://github.com/arduino-libraries/Arduino_Braccio_plusplus/actions/workflows/compile-examples-private.yml)
7+
[![Compile Examples status](https://github.com/arduino-libraries/Arduino_Braccio_plusplus/actions/workflows/compile-examples.yml/badge.svg)](https://github.com/arduino-libraries/Arduino_Braccio_plusplus/actions/workflows/compile-examples.yml)
88
[![Spell Check status](https://github.com/arduino-libraries/Arduino_Braccio_plusplus/actions/workflows/spell-check.yml/badge.svg)](https://github.com/arduino-libraries/Arduino_Braccio_plusplus/actions/workflows/spell-check.yml)
99

1010
This library allows you to control and interact with the 6 DOF Braccio++ robot arm.

0 commit comments

Comments
 (0)