Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .github/check_fragments.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash
# Check whether changelog.d/ contains any fragments (ignoring .gitkeep).
# Sets the GitHub Actions output "count" so later steps can skip if 0.
set -euo pipefail

FRAGMENTS=$(ls changelog.d/ | grep -cv .gitkeep || true)
echo "count=$FRAGMENTS" >> "$GITHUB_OUTPUT"

if [ "$FRAGMENTS" -eq 0 ]; then
echo "No changelog fragments found — skipping release."
else
echo "Found $FRAGMENTS changelog fragment(s)."
fi
16 changes: 16 additions & 0 deletions .github/commit_and_push.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash
# Stage release artifacts and push if anything changed.
set -euo pipefail

git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"

git add package.json CHANGELOG.md changelog.d/

if git diff --staged --quiet; then
echo "No changes to commit."
exit 0
fi

git commit -m "Release @policyengine/ui-kit"
git push
19 changes: 5 additions & 14 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,16 @@ jobs:
release:
name: Bump version, build changelog, publish to npm
runs-on: ubuntu-latest
permissions:
contents: write
if: "!contains(github.event.head_commit.message, 'Release @policyengine/ui-kit')"

steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.POLICYENGINE_GITHUB }}
- uses: actions/checkout@v6

- name: Check for changelog fragments
id: check
run: |
FRAGMENTS=$(ls changelog.d/ | grep -v .gitkeep | wc -l)
echo "count=$FRAGMENTS" >> "$GITHUB_OUTPUT"
run: .github/check_fragments.sh

- name: Bump version
if: steps.check.outputs.count != '0'
Expand Down Expand Up @@ -56,11 +54,4 @@ jobs:

- name: Commit and push
if: steps.check.outputs.count != '0'
uses: EndBug/add-and-commit@v9
with:
message: "Release @policyengine/ui-kit"
default_author: github_actions
add: |
package.json
CHANGELOG.md
changelog.d/
run: .github/commit_and_push.sh
1 change: 1 addition & 0 deletions changelog.d/fix-ci.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix CI/CD workflow: drop expired PAT, use default GITHUB_TOKEN, extract scripts
Loading