From 30c000b96a236dfa430a4a8e670c60e731aa091f Mon Sep 17 00:00:00 2001 From: per1234 Date: Thu, 15 Oct 2020 16:37:35 -0700 Subject: [PATCH] Use the Compile Examples workflow for the deltas report Using a scheduled workflow for the size deltas report is not appropriate in private repositories because it uses a lot of minutes and, unlike public repositories, private repositories have a limited allotment of free GitHub Actions minutes. The `report-size-deltas` job is configured for use in private repositories which don't have the "Send write tokens to workflows from fork pull requests" setting enabled. This means that PRs submitted from forks won't get size deltas reports. If reports on PRs from forks are wanted, the repository can be configured to provide them with write tokens and the workflow adjusted so the job will run on PRs from forks Once the repository is made public, the workflow should be reconfigured to provide size deltas reports on PRs from forks. More information: https://github.com/arduino/report-size-deltas#sketches-reports-source --- .github/workflows/compile-examples.yml | 26 ++++++++++++++++++++++-- .github/workflows/report-size-deltas.yml | 13 ------------ 2 files changed, 24 insertions(+), 15 deletions(-) delete mode 100644 .github/workflows/report-size-deltas.yml diff --git a/.github/workflows/compile-examples.yml b/.github/workflows/compile-examples.yml index a10a755..514242f 100644 --- a/.github/workflows/compile-examples.yml +++ b/.github/workflows/compile-examples.yml @@ -12,6 +12,10 @@ on: - "examples/**" - "src/**" +env: + SKETCHES_REPORTS_PATH: sketches-reports + SKETCHES_REPORTS_ARTIFACT_NAME: sketches-reports + jobs: compile-test: runs-on: ubuntu-latest @@ -87,11 +91,29 @@ jobs: sketch-paths: | ${{ env.UNIVERSAL_SKETCH_PATHS }} enable-deltas-report: 'true' + sketches-report-path: ${{ env.SKETCHES_REPORTS_PATH }} + github-token: ${{ secrets.GITHUB_TOKEN }} verbose: 'true' - name: Save memory usage change report as artifact if: github.event_name == 'pull_request' uses: actions/upload-artifact@v2 with: - name: 'size-deltas-reports' - path: 'size-deltas-reports' + name: ${{ env.SKETCHES_REPORTS_ARTIFACT_NAME }} + path: ${{ env.SKETCHES_REPORTS_PATH }} + + report-size-deltas: + needs: compile-test + # Only run the job when the workflow is triggered by a pull request from this repository (because arduino/report-size-deltas requires write permissions) + if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository + runs-on: ubuntu-latest + steps: + - name: Download sketches reports artifact + uses: actions/download-artifact@v2 + with: + name: ${{ env.SKETCHES_REPORTS_ARTIFACT_NAME }} + path: ${{ env.SKETCHES_REPORTS_PATH }} + + - uses: arduino/report-size-deltas@main + with: + sketches-reports-source: ${{ env.SKETCHES_REPORTS_PATH }} diff --git a/.github/workflows/report-size-deltas.yml b/.github/workflows/report-size-deltas.yml deleted file mode 100644 index fcdf3da..0000000 --- a/.github/workflows/report-size-deltas.yml +++ /dev/null @@ -1,13 +0,0 @@ -name: Report PR Size Deltas - -on: - schedule: - - cron: '*/5 * * * *' - -jobs: - report: - runs-on: ubuntu-latest - - steps: - - name: Comment size deltas reports to PRs - uses: arduino/report-size-deltas@main \ No newline at end of file