Skip to content

Commit

Permalink
Run 'record screenshots' flow if label is present (#1860)
Browse files Browse the repository at this point in the history
* Run 'record screenshots' flow if label is present

---------

Co-authored-by: ElementBot <[email protected]>
  • Loading branch information
jmartinesp and ElementBot authored Nov 23, 2023
1 parent 68c4f1e commit e13b204
Show file tree
Hide file tree
Showing 11 changed files with 39 additions and 23 deletions.
21 changes: 18 additions & 3 deletions .github/workflows/recordScreenshots.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,33 @@ name: Record screenshots

on:
workflow_dispatch:
pull_request:
types: [ labeled ]

# Enrich gradle.properties for CI/CD
env:
GRADLE_OPTS: -Dorg.gradle.jvmargs="-Xmx3584m -Dfile.encoding=UTF-8 -XX:+HeapDumpOnOutOfMemoryError" -Dkotlin.incremental=false -XX:+UseParallelGC

jobs:
record:
name: Record screenshots on branch ${{ github.ref_name }}
name: Record screenshots on branch ${{ github.event.pull_request.head.ref || github.ref_name }}
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch' || github.event.label.name == 'Record-Screenshots'

steps:
- name: ⏬ Checkout with LFS
- name: Remove Record-Screenshots label
if: github.event.label.name == 'Record-Screenshots'
uses: actions-ecosystem/action-remove-labels@v1
with:
labels: Record-Screenshots
- name: ⏬ Checkout with LFS (PR)
if: github.event.label.name == 'Record-Screenshots'
uses: nschloe/[email protected]
with:
persist-credentials: false
ref: ${{ github.event.pull_request.head.ref }}
- name: ⏬ Checkout with LFS (Branch)
if: github.event_name == 'workflow_dispatch'
uses: nschloe/[email protected]
with:
persist-credentials: false
Expand All @@ -28,7 +43,7 @@ jobs:
with:
cache-read-only: ${{ github.ref != 'refs/heads/develop' }}
- name: Record screenshots
run: "./.github/workflows/scripts/recordScreenshots.sh"
run: ./.github/workflows/scripts/recordScreenshots.sh
env:
GITHUB_TOKEN: ${{ secrets.DANGER_GITHUB_API_TOKEN }}
GITHUB_REPOSITORY: ${{ secrets.GITHUB_REPOSITORY }}
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/scripts/recordScreenshots.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ do
esac
done

BRANCH=$(git rev-parse --abbrev-ref HEAD)
echo Branch used: $BRANCH

if [[ -z ${TOKEN} ]]; then
echo "No token specified, either set the env var GITHUB_TOKEN or use the --token option"
exit 1
Expand All @@ -70,8 +73,6 @@ git config user.email "[email protected]"
git add -A
git commit -m "Update screenshots"

BRANCH=$(git rev-parse --abbrev-ref HEAD)

echo "Pushing changes"
git push "https://$TOKEN@github.com/$REPO.git" $BRANCH:refs/heads/$BRANCH
git push "https://$TOKEN@github.com/$REPO.git" $BRANCH
echo "Done!"
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ private fun IconsPreview(
textAlign = TextAlign.Center,
)
iconsList.chunked(6).forEach { iconsRow ->
Row(horizontalArrangement = Arrangement.spacedBy(1.dp)) {
Row(horizontalArrangement = Arrangement.spacedBy(2.dp)) {
iconsRow.forEach { icon ->
Column(
modifier = Modifier.width(48.dp),
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e13b204

Please sign in to comment.