Fix srpm mock logs in UI #167
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Preflight | |
on: | |
pull_request: | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
check-commit-message: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Check commit message | |
run: | | |
errors= | |
readarray -t long_lines < \ | |
<(git log -1 --pretty=format:%B ${{ github.event.pull_request.head.sha }} | grep -E '^.{73,}$') | |
if [[ ${#long_lines[@]} -ne 0 ]]; then | |
printf "ERROR: The following lines are longer than 72 characters:\n" | |
printf " > %s\n" "${long_lines[@]}" | |
errors=true | |
fi | |
if [[ $errors == true ]]; then | |
exit 2 | |
fi | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Get UID and GID | |
id: get-id | |
run: printf "%s\n" uid=$(id -u) gid=$(id -g) >> $GITHUB_OUTPUT | |
- name: Set up Docker Buildx | |
# https://github.com/marketplace/actions/docker-setup-buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build Docker image | |
# https://github.com/marketplace/actions/build-and-push-docker-images | |
uses: docker/build-push-action@v5 | |
id: docker | |
with: | |
context: . | |
load: true | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
build-args: | | |
UID=${{ steps.get-id.outputs.uid }} | |
GID=${{ steps.get-id.outputs.gid }} | |
- name: Run build | |
run: | | |
docker run --rm -v .:/home/albs/code ${{ steps.docker.outputs.imageid }} \ | |
npm run build | |
prettier: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Get changed files | |
# https://github.com/marketplace/actions/paths-changes-filter | |
uses: dorny/paths-filter@v3 | |
id: changed-files | |
with: | |
list-files: shell | |
filters: | | |
src: | |
- added|modified: 'src/**/*.vue' | |
- added|modified: 'src/**/*.js' | |
- name: Get UID and GID | |
if: ${{ steps.changed-files.outputs.src == 'true' }} | |
id: get-id | |
run: printf "%s\n" uid=$(id -u) gid=$(id -g) >> $GITHUB_OUTPUT | |
- name: Set up Docker Buildx | |
# https://github.com/marketplace/actions/docker-setup-buildx | |
uses: docker/setup-buildx-action@v3 | |
if: ${{ steps.changed-files.outputs.src == 'true' }} | |
- name: Build Docker image | |
# https://github.com/marketplace/actions/build-and-push-docker-images | |
uses: docker/build-push-action@v5 | |
if: ${{ steps.changed-files.outputs.src == 'true' }} | |
id: docker | |
with: | |
context: . | |
load: true | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
build-args: | | |
UID=${{ steps.get-id.outputs.uid }} | |
GID=${{ steps.get-id.outputs.gid }} | |
- name: Run prettier | |
if: ${{ steps.changed-files.outputs.src == 'true' }} | |
run: | | |
docker run --rm -v .:/home/albs/code ${{ steps.docker.outputs.imageid }} \ | |
npx prettier --write ${{ steps.changed-files.outputs.src_files }} | |
git -c color.ui=always diff --exit-code |