build-size-workflow: Fix when base gets updated
The github.event.pull_request.base.sha in the workflow doesn't get updated when there are new commits in the base branch. Instead always checkout the branch to check the sha manually and cache only the build. The ownership fix seems to still be necessary
This commit is contained in:
parent
5feccb382a
commit
056b0f5b3f
26
.github/workflows/main.yml
vendored
26
.github/workflows/main.yml
vendored
|
@ -113,21 +113,27 @@ jobs:
|
||||||
# Override SOURCES_DIR in build.sh
|
# Override SOURCES_DIR in build.sh
|
||||||
SOURCES_DIR: .
|
SOURCES_DIR: .
|
||||||
steps:
|
steps:
|
||||||
- name: Cache sources
|
- name: Checkout current base branch files
|
||||||
id: cache-sources
|
|
||||||
uses: actions/cache@v3
|
|
||||||
with:
|
|
||||||
path: .
|
|
||||||
key: source-files-${{ github.event.pull_request.base.sha }}
|
|
||||||
|
|
||||||
- if: ${{ steps.cache-sources.outputs.cache-hit != 'true' }}
|
|
||||||
name: Checkout source files
|
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
ref: ${{ github.base_ref }}
|
ref: ${{ github.base_ref }}
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
|
|
||||||
- if: ${{ steps.cache-sources.outputs.cache-hit != 'true' }}
|
- name: Get base branch SHA
|
||||||
|
id: get-base-sha
|
||||||
|
run: |
|
||||||
|
# Fix for "detected dubious ownership in repository at '/__w/InfiniTime/InfiniTime'"
|
||||||
|
git config --global --add safe.directory /__w/InfiniTime/InfiniTime
|
||||||
|
echo base_sha=$(git rev-parse HEAD) >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Cache build
|
||||||
|
id: cache-build
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: ./build
|
||||||
|
key: build-files-${{ steps.get-base-sha.outputs.base_sha }}
|
||||||
|
|
||||||
|
- if: ${{ steps.cache-build.outputs.cache-hit != 'true' }}
|
||||||
name: Build
|
name: Build
|
||||||
shell: bash
|
shell: bash
|
||||||
# Only pinetime-app target is needed, but post_build.sh fails
|
# Only pinetime-app target is needed, but post_build.sh fails
|
||||||
|
|
Loading…
Reference in a new issue