Skip to content

Commit f47fbb0

Browse files
authored
Merge pull request #6 from PolicyEngine/fix-ci-workflow
Fix CI: drop expired PAT, use default GITHUB_TOKEN
2 parents c27a49f + ff6b876 commit f47fbb0

4 files changed

Lines changed: 35 additions & 14 deletions

File tree

.github/check_fragments.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env bash
2+
# Check whether changelog.d/ contains any fragments (ignoring .gitkeep).
3+
# Sets the GitHub Actions output "count" so later steps can skip if 0.
4+
set -euo pipefail
5+
6+
FRAGMENTS=$(ls changelog.d/ | grep -cv .gitkeep || true)
7+
echo "count=$FRAGMENTS" >> "$GITHUB_OUTPUT"
8+
9+
if [ "$FRAGMENTS" -eq 0 ]; then
10+
echo "No changelog fragments found — skipping release."
11+
else
12+
echo "Found $FRAGMENTS changelog fragment(s)."
13+
fi

.github/commit_and_push.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env bash
2+
# Stage release artifacts and push if anything changed.
3+
set -euo pipefail
4+
5+
git config user.name "github-actions[bot]"
6+
git config user.email "github-actions[bot]@users.noreply.github.com"
7+
8+
git add package.json CHANGELOG.md changelog.d/
9+
10+
if git diff --staged --quiet; then
11+
echo "No changes to commit."
12+
exit 0
13+
fi
14+
15+
git commit -m "Release @policyengine/ui-kit"
16+
git push

.github/workflows/push.yml

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,16 @@ jobs:
88
release:
99
name: Bump version, build changelog, publish to npm
1010
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
1113
if: "!contains(github.event.head_commit.message, 'Release @policyengine/ui-kit')"
1214

1315
steps:
14-
- uses: actions/checkout@v4
15-
with:
16-
token: ${{ secrets.POLICYENGINE_GITHUB }}
16+
- uses: actions/checkout@v6
1717

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

2422
- name: Bump version
2523
if: steps.check.outputs.count != '0'
@@ -56,11 +54,4 @@ jobs:
5654

5755
- name: Commit and push
5856
if: steps.check.outputs.count != '0'
59-
uses: EndBug/add-and-commit@v9
60-
with:
61-
message: "Release @policyengine/ui-kit"
62-
default_author: github_actions
63-
add: |
64-
package.json
65-
CHANGELOG.md
66-
changelog.d/
57+
run: .github/commit_and_push.sh

changelog.d/fix-ci.fixed.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix CI/CD workflow: drop expired PAT, use default GITHUB_TOKEN, extract scripts

0 commit comments

Comments
 (0)