Build only one bundle (#5115)

* check for only:

* skip

* comments
This commit is contained in:
David Holdeman 2023-02-21 08:56:36 -06:00 committed by GitHub
parent a153ca81b0
commit 371557237f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 3 deletions

View File

@ -296,10 +296,23 @@ jobs:
- name: Check branch name
if: ${{ contains(github.ref_name, '.') }}
run: echo '::error::Branch names must not contain ".", this breaks firmware autoupdates.' && exit 1
- name: Execution throttle early exit
# Don't skip any jobs if this workflow was run manually.
if: ${{ matrix.skip-rate && github.event_name != 'workflow_dispatch' }}
run: if (($(($RANDOM % 100)) < ${{ matrix.skip-rate }})); then echo "skip=true" >> $GITHUB_ENV; fi
# Don't skip any jobs if this workflow was run manually,
# or if the commit contains `only:`, signifying that only one bundle should be built.
if: ${{ matrix.skip-rate && github.event_name != 'workflow_dispatch' || contains(github.event.head_commit.message, 'only:') }}
run: |
# if the commit message contains `only:`, get the part after the semicolon and check if it matches the build target.
if echo ${{ github.event.head_commit.message }} | grep "only:"; then
if [ "$(echo ${{ github.event.head_commit.message }} | grep -Po '(?<=only:)[^\s]*')" = "${{ matrix.build-target }}" ]; then
exit 0
else
# if it doesn't match, skip this job.
echo "skip=true" >> $GITHUB_ENV
exit 0
fi
fi
if (($(($RANDOM % 100)) < ${{ matrix.skip-rate }})); then echo "skip=true" >> $GITHUB_ENV; fi
- uses: actions/checkout@v3
if: ${{ env.skip != 'true' }}