Skip to content

Commit 76d7132

Browse files
authored
FNA-1286: fix release workflow blocked by enterprise Actions policy (#559)
- Replace changesets/action@v1 (third-party, blocked) with equivalent shell commands - Pin actions/checkout and actions/setup-node to full commit SHAs - Disable noresponse.yml which uses blocked lee-dohm/no-response action
1 parent 8ab50b5 commit 76d7132

3 files changed

Lines changed: 42 additions & 15 deletions

File tree

.github/workflows/nodejs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ jobs:
1919
node-version: [ lts/-1, lts/*]
2020

2121
steps:
22-
- uses: actions/checkout@v4
22+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
2323
- name: Use Node.js ${{ matrix.node-version }}
24-
uses: actions/setup-node@v3
24+
uses: actions/setup-node@3235b876344d2a9aa001b8d1453c930bba69e610 # v3
2525
with:
2626
node-version: ${{ matrix.node-version }}
2727
- name: Update npm to 8.x

.github/workflows/noresponse.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,7 @@ name: No Response
44
# to work properly.
55
# Details here: https://github.com/lee-dohm/no-response/blob/main/action.yml
66
on:
7-
issue_comment:
8-
types: [created]
9-
schedule:
10-
# Schedule for 00:00 UTC every day
11-
- cron: '0 0 * * *'
7+
workflow_dispatch: # disabled: lee-dohm/no-response is blocked by enterprise policy
128

139
jobs:
1410
noResponse:

.github/workflows/on-merge-main.yml

Lines changed: 39 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,12 @@ jobs:
1717

1818
steps:
1919
- name: Checkout Repo
20-
uses: actions/checkout@v3
20+
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
21+
with:
22+
fetch-depth: 0
23+
token: ${{ secrets.GITHUB_TOKEN }}
2124
- name: Setup Node.js 20
22-
uses: actions/setup-node@v3
25+
uses: actions/setup-node@3235b876344d2a9aa001b8d1453c930bba69e610 # v3
2326
with:
2427
node-version: 20
2528
- name: Update npm to 10.x
@@ -35,12 +38,40 @@ jobs:
3538
run: |
3639
npm run clean
3740
npm run build
38-
- name: "Create Pull Request or Publish to npm"
39-
uses: changesets/action@v1
40-
with:
41-
version: npm run version-packages
42-
publish: npm run npm:publish
43-
commit: "chore: version packages"
41+
- name: Check for changesets
42+
id: changesets
43+
run: |
44+
if [ -n "$(find .changeset -name '*.md' -not -name 'README.md')" ]; then
45+
echo "has_changesets=true" >> $GITHUB_OUTPUT
46+
else
47+
echo "has_changesets=false" >> $GITHUB_OUTPUT
48+
fi
49+
- name: Create Pull Request or Publish to npm
50+
run: |
51+
if [ "${{ steps.changesets.outputs.has_changesets }}" = "true" ]; then
52+
# Changesets exist — open/update a version PR
53+
npm run version-packages
54+
git add -A
55+
git status
56+
if git diff --cached --quiet; then
57+
echo "No version changes to commit"
58+
else
59+
git commit -m "chore: version packages"
60+
BRANCH="changeset-release/main"
61+
git checkout -b "$BRANCH" 2>/dev/null || git checkout "$BRANCH"
62+
git push origin "$BRANCH" --force
63+
gh pr create \
64+
--title "chore: version packages" \
65+
--body "This PR was opened by the release workflow. Merge to publish to npm." \
66+
--base main \
67+
--head "$BRANCH" \
68+
|| gh pr edit "$BRANCH" --title "chore: version packages"
69+
fi
70+
else
71+
# No changesets — publish any packages whose version exceeds what is on npm
72+
npm run npm:publish
73+
fi
4474
env:
4575
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4676
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
77+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)