Skip to content

Commit

Permalink
Change deploy_dist to ensure_dist_committed check
Browse files Browse the repository at this point in the history
  • Loading branch information
elsom25 committed May 2, 2024
1 parent 0e1ec91 commit 2e4cc08
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 151 deletions.
106 changes: 0 additions & 106 deletions .github/workflows/deploy_branch_github_pages.yml.skip

This file was deleted.

45 changes: 0 additions & 45 deletions .github/workflows/deploy_dist.yml

This file was deleted.

51 changes: 51 additions & 0 deletions .github/workflows/ensure_dist_committed.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Ensure distribution files committed are up-to-date

on:
pull_request:
branches:
- main
workflow_dispatch:

jobs:
ensure_dist_committed:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Ruby
uses: ruby/setup-ruby@v1

- name: Install Cue
uses: cue-lang/setup-cue@v1.0.0
with:
version: 'v0.7.0'

- name: Install bundler and gems
run: |
gem install bundler
bundle install --jobs 4 --retry 3
- name: Generate distribution files
run: make

- name: Ensure there are no uncommitted distrubtion file changes
id: ensure-dist-committed
run: |
git diff --exit-code || (echo "Please commit the changes made by the build process" && exit 1)
- name: Inform PR author of failure and path to fix
if: ${{ failure() && steps.ensure-dist-committed.outcome == 'failure' }}
run: |
# Comment to send
COMMENT="Hi there! It looks like your pull request changes taxonomy \`data/*\` files, but is missing updates to \`dist/*\` files.<br /><br />**⏭️ How to fix**<br />Make a PR comment of \`/generate_dist\`, and I will fix this for you :robot:. Alternatively, you can run \`make\` locally and commit the changes yourself."
# GitHub API Token and PR URL
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
COMMENT_URL="https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments"
# Use jq to encode the JSON properly, carefully handling the new lines and backticks
JSON_BODY=$(jq -n --arg body "$COMMENT" '{body: $body}')
# Use curl to post the comment.
curl -s -H "Authorization: token ${GITHUB_TOKEN}" -X POST "$COMMENT_URL" -d "$JSON_BODY"
1 change: 1 addition & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
pull_request:
branches:
- main
workflow_dispatch:

jobs:
test:
Expand Down

0 comments on commit 2e4cc08

Please sign in to comment.