Skip to content

ci: create pr preview and e2e workflow #3

ci: create pr preview and e2e workflow

ci: create pr preview and e2e workflow #3

Workflow file for this run

name: E2E and Preview
on:
push:
branches:
- master
- '[0-9]+.x.x'
pull_request:
branches:
- master
- '[0-9]+.x.x'
permissions:
actions: read
contents: read
pages: write
id-token: write
concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'push' && github.run_number || github.head_ref || github.ref_name || github.event.ref }}
cancel-in-progress: true
jobs:
e2e:
if: ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v5
with:
path: 'skyux-icons'
fetch-depth: '0'
token: '${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}'
- name: Checkout skyux
uses: actions/checkout@v5
with:
repository: 'blackbaud/skyux'
# TODO: change back to main after testing
ref: 'icons-e2e'
path: 'skyux'
token: '${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}'
- name: Set up Node.js
uses: actions/setup-node@v5
with:
node-version-file: 'skyux/.nvmrc'
- name: Install dependencies
run: npm ci
working-directory: '${{ github.workspace }}/skyux-icons'
- name: Build project
run: |
npm run build
mkdir -pv ../skyux/dist
cp -Rv dist ../skyux/dist/skyux-icons
working-directory: '${{ github.workspace }}/skyux-icons'
- name: Review affected icons
id: affected
if: ${{ github.event_name == 'pull_request' }}
run: |
HAS_RENAMES_OR_DELETES=$(git diff --name-status origin/${{ github.base_ref }} | grep -E '^(D|R)' || echo '')
NOT_JUST_CUSTOM_ICONS=$(git diff --name-only origin/${{ github.base_ref }} | grep -v '^src/svg/' || echo '')
if [ -n "$HAS_RENAMES_OR_DELETES" ] || [ -n "$NOT_JUST_CUSTOM_ICONS" ]; then
# Everything.
AFFECTED="tag:icons-e2e"
else
# Specific icons plus icon-storybook-e2e.
AFFECTED="$((git diff --name-only origin/${{ github.base_ref }} | grep '^src/svg/' || echo '') | xargs basename | sed -E 's~-[0-9]+-[a-z]+.svg$~~' | sort -u | sed 's~^~tag:icon:~' | tr '\n' ,)icon-storybook-e2e"
fi
echo "AFFECTED=$AFFECTED"
echo "affected=${AFFECTED}" >> $GITHUB_OUTPUT
working-directory: '${{ github.workspace }}/skyux-icons'
# TODO: run e2e tests and push to Percy