Skip to content

Commit 63e92a4

Browse files
committed
refactor and GH Action
1 parent 200d7b1 commit 63e92a4

File tree

11 files changed

+315
-246
lines changed

11 files changed

+315
-246
lines changed

.github/workflows/issue-sync.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Issue Sync
2+
3+
on:
4+
issue_comment:
5+
types: [created, edited, deleted]
6+
issue:
7+
types: [opened]
8+
9+
jobs:
10+
sync-issue:
11+
name: Sync Issue with Project Board
12+
runs-on: ubuntu-latest
13+
permissions:
14+
issues: write
15+
pull-requests: write
16+
contents: read
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
21+
- name: Setup Node.js
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: '20'
25+
cache: 'yarn'
26+
cache-dependency-path: 'tools/@aws-cdk/project-sync/yarn.lock'
27+
28+
# Cache node_modules
29+
- name: Cache node_modules
30+
uses: actions/cache@v3
31+
id: cache-modules
32+
with:
33+
path: tools/@aws-cdk/project-sync/node_modules
34+
key: ${{ runner.os }}-modules-${{ hashFiles('tools/@aws-cdk/project-sync/yarn.lock') }}
35+
restore-keys: |
36+
${{ runner.os }}-modules-
37+
38+
- name: Install dependencies
39+
if: steps.cache-modules.outputs.cache-hit != 'true'
40+
run: |
41+
cd tools/@aws-cdk/project-sync
42+
yarn install --frozen-lockfile
43+
44+
# Cache build output
45+
- name: Cache build output
46+
uses: actions/cache@v3
47+
id: cache-build
48+
with:
49+
path: |
50+
tools/@aws-cdk/project-sync/lib
51+
tools/@aws-cdk/project-sync/bin/*.js
52+
tools/@aws-cdk/project-sync/bin/*.d.ts
53+
key: ${{ runner.os }}-build-${{ hashFiles('tools/@aws-cdk/project-sync/lib/**', 'tools/@aws-cdk/project-sync/bin/**', 'tools/@aws-cdk/project-sync/tsconfig.json') }}
54+
restore-keys: |
55+
${{ runner.os }}-build-
56+
57+
- name: Build project-sync
58+
if: steps.cache-build.outputs.cache-hit != 'true'
59+
run: |
60+
cd tools/@aws-cdk/project-sync
61+
yarn build
62+
63+
- name: Run issue-sync
64+
env:
65+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
66+
ISSUE_NUMBER: ${{ github.event.issue.number }}
67+
run: |
68+
cd tools/@aws-cdk/project-sync
69+
node bin/issue-sync.js
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { syncAllIssues } from '../lib/issue-sync-all.js';
2+
3+
syncAllIssues();
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import { syncIssue } from "../lib/issue-sync";
1+
import { syncIssue } from '../lib/issue-sync';
22

3-
if(process.env.ISSUE_NUMBER === undefined)
4-
throw Error("Environment variable ISSUE_NUMBER is not defined")
3+
if (process.env.ISSUE_NUMBER === undefined) {throw Error('Environment variable ISSUE_NUMBER is not defined');}
54

6-
syncIssue(process.env.ISSUE_NUMBER).then(console.log).catch(console.error)
5+
syncIssue(process.env.ISSUE_NUMBER).then(console.log).catch(console.error);

tools/@aws-cdk/project-sync/bin/sync-p1-bugs.ts

Lines changed: 0 additions & 73 deletions
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const PROJECT_NUMBER = process.env.PROJECT_NUMBER || '302';

0 commit comments

Comments
 (0)