Skip to content

Commit db1f504

Browse files
committed
ci: add checks for act environment in CI/CD pipeline steps
1 parent a5cb737 commit db1f504

File tree

2 files changed

+38
-13
lines changed

2 files changed

+38
-13
lines changed

.github/workflows/ci.yml

Lines changed: 37 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,17 @@ jobs:
3232
- name: Run tests
3333
run: npm test --silent
3434

35+
- name: Check whether running under act (set output)
36+
id: check_act_test
37+
run: |
38+
if [ "${IS_ACT}" = "true" ]; then
39+
echo "is_act=true" >> $GITHUB_OUTPUT
40+
else
41+
echo "is_act=false" >> $GITHUB_OUTPUT
42+
fi
43+
3544
- name: Upload coverage report
36-
if: always()
45+
if: ${{ always() && steps.check_act_test.outputs.is_act != 'true' }}
3746
uses: actions/upload-artifact@v4
3847
with:
3948
name: jest-coverage
@@ -56,18 +65,30 @@ jobs:
5665
- name: Checkout repository
5766
uses: actions/checkout@v4
5867
with:
59-
fetch-depth: 0
68+
fetch-depth: 0
69+
70+
- name: Check whether running under act (set output)
71+
id: check_act_release
72+
run: |
73+
if [ "${IS_ACT}" = "true" ]; then
74+
echo "is_act=true" >> $GITHUB_OUTPUT
75+
else
76+
echo "is_act=false" >> $GITHUB_OUTPUT
77+
fi
6078
6179
- name: Setup Node.js
80+
if: ${{ steps.check_act_release.outputs.is_act != 'true' }}
6281
uses: actions/setup-node@v4
6382
with:
6483
node-version: 18
6584
cache: 'npm'
6685

6786
- name: Install dependencies
87+
if: ${{ steps.check_act_release.outputs.is_act != 'true' }}
6888
run: npm ci
6989

7090
- name: Semantic Release
91+
if: ${{ steps.check_act_release.outputs.is_act != 'true' }}
7192
uses: cycjimmy/semantic-release-action@v4
7293
with:
7394
extra_plugins: |
@@ -86,19 +107,32 @@ jobs:
86107
- name: Checkout repository
87108
uses: actions/checkout@v4
88109

110+
- name: Check whether running under act (set output)
111+
id: check_act_deploy
112+
run: |
113+
if [ "${IS_ACT}" = "true" ]; then
114+
echo "is_act=true" >> $GITHUB_OUTPUT
115+
else
116+
echo "is_act=false" >> $GITHUB_OUTPUT
117+
fi
118+
89119
- name: Setup Node.js
120+
if: ${{ steps.check_act_deploy.outputs.is_act != 'true' }}
90121
uses: actions/setup-node@v4
91122
with:
92123
node-version: 18
93124
cache: 'npm'
94125

95126
- name: Install dependencies
127+
if: ${{ steps.check_act_deploy.outputs.is_act != 'true' }}
96128
run: npm ci
97129

98130
- name: Build project
131+
if: ${{ steps.check_act_deploy.outputs.is_act != 'true' }}
99132
run: npm run build
100133

101134
- name: Deploy to Render
135+
if: ${{ steps.check_act_deploy.outputs.is_act != 'true' }}
102136
env:
103137
RENDER_API_KEY: ${{ secrets.RENDER_API_KEY }}
104138
RENDER_SERVICE_ID: ${{ secrets.RENDER_SERVICE_ID }}
@@ -109,7 +143,7 @@ jobs:
109143
-d ''
110144
111145
- name: Send Telegram notification
112-
if: always()
146+
if: ${{ always() && steps.check_act_deploy.outputs.is_act != 'true' }}
113147
run: |
114148
MESSAGE="✅ Deployment completed successfully on Render!
115149
🕓 $(date)
@@ -118,13 +152,3 @@ jobs:
118152
curl -s -X POST https://api.telegram.org/bot${{ secrets.TELEGRAM_BOT_TOKEN }}/sendMessage \
119153
-d chat_id=${{ secrets.TELEGRAM_CHAT_ID }} \
120154
-d text="$MESSAGE"
121-
122-
security:
123-
name: 🔒 Secret Scanning
124-
runs-on: ubuntu-latest
125-
steps:
126-
- uses: actions/checkout@v4
127-
- name: Run Gitleaks
128-
uses: zricethezav/gitleaks-action@v2
129-
with:
130-
args: detect --source . --no-git --verbose

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,6 @@ yarn-debug.log*
2323
yarn-error.log*
2424

2525
.env
26+
.env.act
2627
initial-users.js
2728
node_modules

0 commit comments

Comments
 (0)