Skip to content

Commit

Permalink
fix(tools): conditional in script
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicholas Carrigan committed Dec 15, 2021
1 parent 20022cb commit 2f27b81
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions .github/workflows/require-dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ on:
- "main"
paths:
- "src/**"
- "!dist/index.js"

jobs:
issue-warning:
Expand All @@ -15,10 +14,17 @@ jobs:
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: "Hello there!\n\nThank you for your interest in contributing. However, it looks like you have made changes to the action's code without including an updated distribution build. Please run `npm run package` on your local version of this branch, commit the new `dist/index.js` file, and push it to this PR."
const files = await github.rest.pulls.listFiles({
owner: context.payload.repository.owner.login,
repo: context.payload.repository.name,
pull_number: context.payload.pull_request.number,
});
core.setFailed("Missing Distribution Build.");
if (files.data[0].filename !== "dist/index.js") {
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: "Hello there!\n\nThank you for your interest in contributing. However, it looks like you have made changes to the action's code without including an updated distribution build. Please run `npm run package` on your local version of this branch, commit the new `dist/index.js` file, and push it to this PR."
});
core.setFailed("Missing Distribution Build.");
};

0 comments on commit 2f27b81

Please sign in to comment.