Skip to content

Commit 4461bf3

Browse files
authored
fix(EC-24260): Update CI workflows (#27)
* Update GitHub Actions workflows * fix: address Copilot security findings - Add permissions block to build.yml (contents: read) - Pin creyD/prettier_action to commit hash for supply chain safety * fix: add write permissions to prettier workflow * Prettified Code! --------- Co-authored-by: yasinghasmi <yasinghasmi@users.noreply.github.com>
1 parent 0c0d52f commit 4461bf3

7 files changed

Lines changed: 49 additions & 47 deletions

File tree

.github/workflows/build-dist.yml

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,20 @@ name: Build dist
22

33
on:
44
push:
5-
branches:
6-
- main
5+
branches: [main]
76

87
jobs:
98
build:
10-
runs-on: ubuntu-latest
9+
runs-on: ubuntu-24.04
1110
permissions:
1211
contents: write
1312
steps:
1413
- uses: actions/checkout@v4
15-
1614
- uses: actions/setup-node@v4
1715
with:
18-
node-version: 20
19-
20-
- name: Install dependencies
21-
run: npm install
22-
23-
- name: Build
24-
run: npm run build
25-
16+
node-version: '24.x'
17+
- run: npm install
18+
- run: npm run build
2619
- name: Push dist to main-dist branch
2720
run: |
2821
git config user.name "github-actions[bot]"

.github/workflows/build.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-24.04
15+
steps:
16+
- uses: actions/checkout@v4
17+
- uses: actions/setup-node@v4
18+
with:
19+
node-version: '24.x'
20+
- run: npm install
21+
- run: npm run build
22+
- run: npm test

.github/workflows/jest-tests.yml

Lines changed: 0 additions & 16 deletions
This file was deleted.

.github/workflows/prettier.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,24 @@ name: Prettier
22

33
on:
44
push:
5-
branches: [ main ]
5+
branches: [main]
66
pull_request:
7-
branches: [ main ]
7+
branches: [main]
8+
9+
permissions:
10+
contents: write
811

912
jobs:
1013
prettier:
11-
runs-on: ubuntu-latest
14+
runs-on: ubuntu-24.04
1215
steps:
1316
- name: Checkout
14-
uses: actions/checkout@v2
17+
uses: actions/checkout@v4
1518
with:
1619
ref: ${{ github.head_ref }}
1720

1821
- name: Prettify code
19-
uses: creyD/prettier_action@v3.3
22+
uses: creyD/prettier_action@31355f8eef017f8aeba2e0bc09d8502b13dbbad1 # v4.3
2023
with:
2124
prettier_options: --write **/*.{js,md}
2225
env:
Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,25 @@ on:
33
release:
44
types: [created]
55

6+
permissions:
7+
contents: write
8+
id-token: write
9+
610
jobs:
711
publish:
8-
runs-on: ubuntu-20.04
12+
runs-on: ubuntu-24.04
913
steps:
10-
- uses: actions/checkout@v2
11-
- uses: actions/setup-node@v2
14+
- uses: actions/checkout@v4
15+
- uses: actions/setup-node@v4
1216
with:
13-
node-version: '12.x'
17+
node-version: '24.x'
1418
registry-url: 'https://registry.npmjs.org'
1519
- run: npm install
1620
- run: npm run build
1721
- run: npm publish
18-
env:
19-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
2022
updateDocs:
21-
runs-on: ubuntu-20.04
22-
if: success()
23+
runs-on: ubuntu-24.04
24+
needs: publish
2325
steps:
2426
- name: Call update docs
2527
env:
@@ -28,4 +30,3 @@ jobs:
2830
WORKFLOW_ID: 90722302
2931
run: |
3032
curl -fL --retry 3 -X POST -H "Accept: application/vnd.github.v3+json" -H "Authorization: token ${{ secrets.TOKEN }}" https://api.github.com/repos/${{ env.REPO }}/actions/workflows/${{ env.WORKFLOW_ID }}/dispatches -d '{"ref":"main", "inputs": {}}'
31-

.github/workflows/update-docs.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ on:
44

55
jobs:
66
update-docs:
7-
runs-on: ubuntu-20.04
7+
runs-on: ubuntu-24.04
88
steps:
99
- uses: actions/checkout@v4
1010
with:
1111
fetch-depth: 1
1212
path: 'authentication'
13-
- uses: actions/setup-node@v2
13+
- uses: actions/setup-node@v4
1414
with:
15-
node-version: '20.x'
15+
node-version: '24.x'
1616
- name: Clone docs
1717
run: |
1818
cd $GITHUB_WORKSPACE/

readme.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,7 @@ const authenticationContext = new AuthenticationContext({
6363
method: "POST",
6464
body: JSON.stringify({ token }),
6565
}).then(() => {}),
66-
refreshAccessToken: () =>
67-
fetch("/auth/refresh").then((r) => r.json()),
66+
refreshAccessToken: () => fetch("/auth/refresh").then((r) => r.json()),
6867
revokeRefreshToken: () =>
6968
fetch("/auth/revoke", { method: "POST" }).then(() => {}),
7069
});

0 commit comments

Comments
 (0)