Skip to content

Commit

Permalink
Merge branch 'EddieHubCommunity:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
foss2cyber authored Aug 24, 2023
2 parents 7fc6d0a + e00a18e commit e5b0765
Show file tree
Hide file tree
Showing 365 changed files with 14,113 additions and 4,676 deletions.
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ playwright.config.js
.gitpod.Dockerfile
SECURITY.md
README.md
docker-compose.yml
compose.yml
mongo-compose.yml
LICENSE
CONTRIBUTING.md
Expand Down
2 changes: 2 additions & 0 deletions .env.docker
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ NEXTAUTH_SECRET=""

LINKFREE_API_SECRET="development"
GITHUB_API_TOKEN=""
RANDOM_USERS="eddiejaoude,SaraJaoude"
ADMIN_USERS="eddiejaoude,SaraJaoude"
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ NEXTAUTH_URL="http://localhost:3000"
LINKFREE_API_SECRET="development"
GITHUB_API_TOKEN=""
RANDOM_USERS="eddiejaoude,sarajaoude"
ADMIN_USERS="eddiejaoude,SaraJaoude,_test-admin-user"
20 changes: 20 additions & 0 deletions .github/config/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
'✍ chore: profile':
- 'data/**'

tests:
- 'tests/**'

storybook:
- 'stories/**'

dependencies:
- 'package.*'

'CI/CD':
- '.github/**'

'📖 docs':
- 'pages/docs/**'

'models':
- 'models/**'
102 changes: 0 additions & 102 deletions .github/config/reviewpad.yml

This file was deleted.

13 changes: 13 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
# only security updates, ignore schedule
# https://docs.github.com/en/code-security/dependabot/dependabot-security-updates/configuring-dependabot-security-updates
open-pull-requests-limit: 0
schedule:
interval: "monthly"
# set commit message to work with Angular conventional commit style
commit-message:
prefix: "fix(deps)"
prefix-development: "chore(deps)"
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ jobs:
strategy:
fail-fast: false
matrix:
shardIndex: [1, 2, 3]
shardTotal: [3]
shardIndex: [1, 2, 3, 4, 5]
shardTotal: [5]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
Expand Down
83 changes: 83 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ "main" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "main" ]
paths-ignore:
- '**/*.md'
- '**/*.json'

jobs:
analyze:
name: Analyze
# Runner size impacts CodeQL analysis time. To learn more, please see:
# - https://gh.io/recommended-hardware-resources-for-running-codeql
# - https://gh.io/supported-runners-and-hardware-resources
# - https://gh.io/using-larger-runners
# Consider using larger runners for possible analysis time improvements.
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'javascript' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby', 'swift' ]
# Use only 'java' to analyze code written in Java, Kotlin or both
# Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality


# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"
89 changes: 89 additions & 0 deletions .github/workflows/labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Label PRs

on:
- pull_request_target

permissions:
contents: read
pull-requests: write

jobs:
label:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3 # Uploads repository content to the runner to ensure config file available
with:
sparse-checkout: |
.github/config/labeler.yml
sparse-checkout-cone-mode: false
- uses: actions/labeler@v4
with:
configuration-path: .github/config/labeler.yml
repo-token: ${{ secrets.GITHUB_TOKEN }}
dot: true
sync-labels: true

issue-linked:
runs-on: ubuntu-latest

steps:
- uses: octokit/graphql-action@v2.x
id: get_linked_issue
with:
query: |
query issue($owner:String!,$repo:String!,$pr:Int!) {
repository(owner:$owner,name:$repo) {
pullRequest(number: $pr) {
closingIssuesReferences (first: 1) {
nodes {
number
assignees(first: 1) {
nodes {
login
}
}
}
}
}
}
}
variables: |
owner: ${{ github.repository_owner }}
repo: ${{ github.event.repository.name }}
pr: ${{ github.event.pull_request.number}}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Count linked issues
id: count_nodes
env:
GH_DETAILS: ${{ steps.get_linked_issue.outputs.data }}
run: |
GH_COUNT=$(echo "$GH_DETAILS" | jq '.repository.pullRequest.closingIssuesReferences.nodes | length')
echo "count=$GH_COUNT" >> "$GITHUB_OUTPUT"
echo "count=$GH_COUNT"
- name: Check assignee count
id: assignee_ct
if: steps.count_nodes.outputs.count > 0
env:
GH_DETAILS: ${{ steps.get_linked_issue.outputs.data }}
run: |
GH_ASSIGNCT=$(echo "$GH_DETAILS" | jq '.repository.pullRequest.closingIssuesReferences.nodes[0].assignees.nodes | length')
echo "count=$GH_ASSIGNCT" >> "$GITHUB_OUTPUT"
echo "count=$GH_ASSIGNCT"
- name: Check assignee
id: assignee
if: steps.count_nodes.outputs.count > 0 && steps.assignee_ct.outputs.count > 0
env:
GH_DETAILS: ${{ steps.get_linked_issue.outputs.data }}
run: |
GH_ASSIGN=$(echo "$GH_DETAILS" | jq -r '.repository.pullRequest.closingIssuesReferences.nodes[0].assignees.nodes[0].login')
echo "name=$GH_ASSIGN" >> "$GITHUB_OUTPUT"
echo "name=$GH_ASSIGN"
echo "${{ github.actor }}"
- name: Add issue-linked label
if: steps.count_nodes.outputs.count > 0 && steps.assignee_ct.outputs.count > 0 && github.actor == steps.assignee.outputs.name
run: |
gh pr edit ${{ github.event.pull_request.number}} --add-label 'issue linked' --repo $GITHUB_REPOSITORY
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8 changes: 5 additions & 3 deletions .github/workflows/publish-ghcr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,11 @@ jobs:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.CR_PAT }}
- name: Setup Env
run: echo "LINKFREE_MONGO_CONNECTION_STRING=${{ secrets.LINKFREE_MONGO_CONNECTION_STRING }}" > /tmp/.env
- name: push to Github Container Registry
- name: Copy Environment Variables
run: cp .env.example /tmp/.env
- name: Add Mongo Connection String
run: echo "LINKFREE_MONGO_CONNECTION_STRING=${{ secrets.LINKFREE_MONGO_CONNECTION_STRING }}" >> /tmp/.env
- name: Build and push to GHCR
uses: docker/build-push-action@v3
with:
context: .
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,19 @@ jobs:
github-token: ${{ secrets.GITHUB_TOKEN }}
version-file: "./package.json,./package-lock.json,./config/app.json"
git-branch: "release-from-${{ github.sha }}"
skip-on-empty: false
skip-git-pull: true

# create PR using GitHub CLI
- name: create PR with release info
if: steps.changelog.outputs.skipped == 'false'
id: create-pr
run: gh pr create --base main --head release-from-${{ github.sha }} --title 'Merge new release into main' --body 'Created by Github action'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# merge PR using GitHub CLI
- name: merge PR with release info
if: steps.changelog.outputs.skipped == 'false'
id: merge-pr
run: gh pr merge --admin --merge --subject 'Merge release info' --delete-branch
env:
Expand All @@ -68,6 +69,6 @@ jobs:
uses: ncipollo/release-action@v1
with:
token: ${{ secrets.CHANGELOG_RELEASE }}
tag : ${{ steps.changelog.outputs.tag }}
tag: ${{ steps.changelog.outputs.tag }}
name: ${{ steps.changelog.outputs.tag }}
body: ${{ steps.changelog.outputs.clean_changelog }}
Loading

0 comments on commit e5b0765

Please sign in to comment.