diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e59b14e550..19cda9348c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -148,14 +148,22 @@ jobs: return; } - const files = await github.paginate(github.rest.pulls.listFiles, { + const getContent = (ref) => github.rest.repos.getContent({ owner: context.repo.owner, repo: context.repo.repo, - pull_number: pr.number, + path: 'composer.lock', + ref, }); - const lockFile = files.find(f => f.filename === 'composer.lock'); - const databaseChanged = lockFile?.patch?.includes('"name": "utopia-php/database"') ?? false; + const getDbVersion = (lock) => lock.packages?.find(p => p.name === 'utopia-php/database')?.version; + + const [{ data: base }, { data: head }] = await Promise.all([ + getContent(pr.base.sha), + getContent(pr.head.sha), + ]); + + const decode = (content) => JSON.parse(Buffer.from(content, 'base64').toString()); + const databaseChanged = getDbVersion(decode(base.content)) !== getDbVersion(decode(head.content)); core.setOutput('databases', JSON.stringify(databaseChanged ? allDatabases : defaultDatabases)); core.setOutput('modes', JSON.stringify(databaseChanged ? allModes : defaultModes));