Skip to content

Commit

Permalink
chore: Refactor build workflow to handle multiple commits and check f…
Browse files Browse the repository at this point in the history
…or version change
  • Loading branch information
cyanxiao committed May 2, 2024
1 parent 570e1ba commit ea9a6c8
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,14 @@ jobs:
with:
script: |
const payload = context.payload;
const headCommit = payload.commits[payload.commits.length - 1];
const changedFiles = headCommit.modified.concat(headCommit.added).concat(headCommit.removed);
let changedFiles = [];
for (const commit of payload.commits) {
if (commit.modified) changedFiles = changedFiles.concat(commit.modified);
if (commit.added) changedFiles = changedFiles.concat(commit.added);
if (commit.removed) changedFiles = changedFiles.concat(commit.removed);
}
const isVersionChanged = changedFiles.includes('pyproject.toml');
if (!isVersionChanged) {
Expand All @@ -48,8 +54,3 @@ jobs:
return false;
}
result-encoding: string
- name: Publish Package
if: steps.check_version.outputs.new_version
uses: JRubics/[email protected]
with:
pypi_token: ${{ secrets.PYPI_API_TOKEN }}

0 comments on commit ea9a6c8

Please sign in to comment.