ci: hard code db credentials

To fix Github Actions secrets access restriction for PRs originating from forks.

Signed-off-by: Rifa Achrinza <25147899+achrinza@users.noreply.github.com>
This commit is contained in:
Rifa Achrinza 2023-11-15 22:34:40 +08:00 committed by Samarpan Bhattacharya
parent febee69426
commit 9045ad868c
2 changed files with 7 additions and 11 deletions

View File

@ -6,12 +6,13 @@ on:
# The branches below must be a subset of the branches above # The branches below must be a subset of the branches above
branches: [master] branches: [master]
env:
CI: true
jobs: jobs:
build: build:
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
env:
MYSQL_HOST: '127.0.0.1'
MYSQL_USER: myUser
MYSQL_PASSWORD: myPass
strategy: strategy:
matrix: matrix:
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/ # See supported Node.js release schedule at https://nodejs.org/en/about/releases/
@ -26,17 +27,12 @@ jobs:
with: with:
mysql-version: 8.0 mysql-version: 8.0
- run: | - run: |
sudo mysql -e "CREATE USER '${{ secrets.MYSQL_USER }}'@'localhost' IDENTIFIED BY '${{ secrets.MYSQL_PASSWORD }}'" sudo mysql -e "CREATE USER '$MYSQL_USER'@'localhost' IDENTIFIED BY '$MYSQL_PASSWORD'"
sudo mysql -u root -e "GRANT ALL PRIVILEGES ON *.* TO '${{ secrets.MYSQL_USER }}'@'localhost'" sudo mysql -u root -e "GRANT ALL PRIVILEGES ON *.* TO '$MYSQL_USER'@'localhost'"
sudo mysql -u root -e "ALTER USER '${{ secrets.MYSQL_USER }}'@'localhost' IDENTIFIED WITH mysql_native_password by '${{ secrets.MYSQL_PASSWORD }}'" sudo mysql -u root -e "ALTER USER '$MYSQL_USER'@'localhost' IDENTIFIED WITH mysql_native_password by '$MYSQL_PASSWORD'"
sudo mysql -u root -e "FLUSH PRIVILEGES" sudo mysql -u root -e "FLUSH PRIVILEGES"
- run: npm install - run: npm install
- run: npm test - run: npm test
env:
MYSQL_HOST: '127.0.0.1'
MYSQL_USER: ${{ secrets.MYSQL_USER }}
MYSQL_PASSWORD: ${{ secrets.MYSQL_PASSWORD }}
CI: true
code-lint: code-lint:
name: Code Lint name: Code Lint
runs-on: ubuntu-latest runs-on: ubuntu-latest

BIN
.setup.sh.swp Normal file

Binary file not shown.