Skip to content
This repository was archived by the owner on Sep 9, 2024. It is now read-only.

Commit 1a42e9b

Browse files
committed
chore: add github actions
1 parent 792cfba commit 1a42e9b

File tree

2 files changed

+114
-0
lines changed

2 files changed

+114
-0
lines changed

.github/workflows/codeql.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: "CodeQL"
13+
14+
on:
15+
push:
16+
branches: ["main"]
17+
pull_request:
18+
# The branches below must be a subset of the branches above
19+
branches: ["main"]
20+
schedule:
21+
- cron: "0 9 * * 4"
22+
23+
jobs:
24+
analyze:
25+
name: Analyze
26+
runs-on: ubuntu-latest
27+
permissions:
28+
actions: read
29+
contents: read
30+
security-events: write
31+
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
language: ["javascript"]
36+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
37+
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
38+
39+
steps:
40+
- name: Checkout repository
41+
uses: actions/checkout@v3
42+
43+
# Initializes the CodeQL tools for scanning.
44+
- name: Initialize CodeQL
45+
uses: github/codeql-action/init@v2
46+
with:
47+
languages: ${{ matrix.language }}
48+
# If you wish to specify custom queries, you can do so here or in a config file.
49+
# By default, queries listed here will override any specified in a config file.
50+
# Prefix the list here with "+" to use these queries and those in the config file.
51+
52+
# 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
53+
# queries: security-extended,security-and-quality
54+
55+
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
56+
# If this step fails, then you should remove it and run the build manually (see below)
57+
- name: Autobuild
58+
uses: github/codeql-action/autobuild@v2
59+
60+
# ℹ️ Command-line programs to run using the OS shell.
61+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
62+
63+
# If the Autobuild fails above, remove it and uncomment the following three lines.
64+
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
65+
66+
# - run: |
67+
# echo "Run, Build Application using script"
68+
# ./location_of_script_within_repo/buildscript.sh
69+
70+
- name: Perform CodeQL Analysis
71+
uses: github/codeql-action/analyze@v2
72+
with:
73+
category: "/language:${{matrix.language}}"

.github/workflows/pr-title.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: "Conventional Commits PR Title"
2+
3+
on:
4+
pull_request_target:
5+
types:
6+
- opened
7+
- edited
8+
- synchronize
9+
10+
jobs:
11+
main:
12+
name: Validate PR title
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: amannn/action-semantic-pull-request@v5
16+
env:
17+
GITHUB_TOKEN: ${{ secrets.PR_TITLE_TOKEN }}
18+
19+
- uses: marocchino/sticky-pull-request-comment@v2
20+
# When the previous steps fails, the workflow would stop. By adding this
21+
# condition you can continue the execution with the populated error message.
22+
if: always() && (steps.lint_pr_title.outputs.error_message != null)
23+
with:
24+
header: pr-title-lint-error
25+
message: |
26+
Hey there and thank you for opening this pull request! 👋🏼
27+
28+
We require pull request titles to follow the [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/) and it looks like your proposed title needs to be adjusted.
29+
30+
Details:
31+
32+
```
33+
${{ steps.lint_pr_title.outputs.error_message }}
34+
```
35+
36+
# Delete a previous comment when the issue has been resolved
37+
- if: ${{ steps.lint_pr_title.outputs.error_message == null }}
38+
uses: marocchino/sticky-pull-request-comment@v2
39+
with:
40+
header: pr-title-lint-error
41+
delete: true

0 commit comments

Comments
 (0)