0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-04-15 03:01:37 -05:00

Fixed --since parameter for partial executions

- if a branch is force-pushed, the existing value is incorrect and we
  get errors from Lerna
- this switches to finding the common commit between this branch and
  the head as reported by GitHub
This commit is contained in:
Daniel Lockyer 2023-07-10 09:36:18 +02:00 committed by Daniel Lockyer
parent 5b7a89d8fc
commit b4d9191522

View file

@ -13,6 +13,8 @@ on:
env:
FORCE_COLOR: 1
HEAD_COMMIT: ${{ github.sha }}
BASE_COMMIT: ${{ github.event.pull_request.base.sha || github.event.before }}
GITHUB_CONTEXT: ${{ toJson(github) }}
CACHED_DEPENDENCY_PATHS: |
${{ github.workspace }}/node_modules
${{ github.workspace }}/apps/*/node_modules
@ -44,6 +46,7 @@ jobs:
COMMIT_SHA=$(git rev-parse --short ${{ github.event.pull_request.head.sha || github.event.head_commit.id || env.HEAD_COMMIT }})
echo "COMMIT_SHA=$COMMIT_SHA" >> $GITHUB_ENV
echo "COMMIT_MESSAGE=$(git log -n 1 --pretty=format:%s $COMMIT_SHA)" >> $GITHUB_ENV
echo "COMMON_COMMIT=$(git merge-base HEAD ${{ env.BASE_COMMIT }})" >> $GITHUB_ENV
- name: Determine changed packages
uses: AurorNZ/paths-filter@v3.0.1
@ -157,7 +160,7 @@ jobs:
path: ghost/**/.eslintcache
key: eslint-cache
- run: yarn lint --since ${{ github.event.pull_request.base.sha || github.event.before }}
- run: yarn lint --since ${{ env.COMMON_COMMIT }}
- uses: tryghost/actions/actions/slack-build@main
if: failure() && github.event_name == 'push' && github.ref == 'refs/heads/main'
@ -230,7 +233,7 @@ jobs:
env:
DEPENDENCY_CACHE_KEY: ${{ needs.job_install_deps.outputs.dependency_cache_key }}
- run: yarn test:unit --include-dependents --since ${{ github.event.pull_request.base.sha || github.event.before }}
- run: yarn test:unit --include-dependents --since ${{ env.COMMON_COMMIT }}
- uses: actions/upload-artifact@v3
if: startsWith(matrix.node, '18')