Skip to content

feat: github action to run otp provider unit tests #447

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 16, 2025
Merged

Conversation

NithinKuruba
Copy link
Contributor

No description provided.

Comment on lines +13 to +69
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- name: Cache Node dependencies
uses: actions/cache@v4
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: ${{ runner.os }}-yarn-

- name: Install asdf requirements
run: |
sudo apt-get install -y libssl-dev libreadline-dev uuid-dev

- name: Install asdf
uses: asdf-vm/actions/setup@v3
- name: Cache asdf tools
uses: actions/cache@v4
with:
path: |
/home/runner/.asdf
key: ${{ runner.os }}-${{ hashFiles('**/.tool-versions') }}

- name: Install asdf
uses: asdf-vm/actions/install@v3

- name: Install app specific asdf plugins
run: |
cat .tool-versions | cut -f 1 -d ' ' | xargs -n 1 asdf plugin-add || true
asdf plugin-update --all
asdf install
asdf reshim
working-directory: ./docker/otp-provider

- name: Install dependencies
run: yarn install
working-directory: ./docker/otp-provider

- name: Setup postgres
env:
PGUSER: postgres
run: |
pg_ctl start
createdb runner || true
chmod +x ./db-setup.sh
./db-setup.sh otp_test
working-directory: ./docker/otp-provider/.bin

- name: Run unit tests
run: |
yarn test
working-directory: ./docker/otp-provider

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI 5 days ago

To fix the issue, we need to add a permissions block to the workflow. This block should specify the minimum permissions required for the workflow to function correctly. Based on the tasks performed in the workflow, the contents: read permission is sufficient, as the workflow does not modify repository contents or require write access.

The permissions block can be added at the root level of the workflow file to apply to all jobs, or it can be added specifically to the otp-provider-test job. In this case, adding it at the root level is more concise and ensures consistency across all jobs.


Suggested changeset 1
.github/workflows/otp-provider-tests.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/otp-provider-tests.yml b/.github/workflows/otp-provider-tests.yml
--- a/.github/workflows/otp-provider-tests.yml
+++ b/.github/workflows/otp-provider-tests.yml
@@ -10,2 +10,5 @@
 
+permissions:
+  contents: read
+
 jobs:
EOF
@@ -10,2 +10,5 @@

permissions:
contents: read

jobs:
Copilot is powered by AI and may make mistakes. Always verify output.
@NithinKuruba NithinKuruba merged commit d8c3be9 into dev Jun 16, 2025
8 checks passed
@NithinKuruba NithinKuruba deleted the SSOTEAM-2382-01 branch June 16, 2025 21:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants