Skip to content

Commit

Permalink
release-->main
Browse files Browse the repository at this point in the history
  • Loading branch information
Raj-StepSecurity committed Nov 21, 2024
1 parent 72891fb commit a725c3a
Show file tree
Hide file tree
Showing 21 changed files with 38,242 additions and 1 deletion.
10 changes: 10 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Global
* @ffried

# Workflow & Deployment related files
.github/* @ffried
action.yml @ffried

# Project & Source files
/*.json @ffried
*.ts @ffried
17 changes: 17 additions & 0 deletions .github/actions/generate-action-code/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Generate Action Code
description: Generates the action code

runs:
using: composite
steps:
- uses: actions/setup-node@v4
with:
node-version: 20
check-latest: true
cache: 'npm'
- name: Generate action code
shell: bash
run: |
npm clean-install
npm run build
npm run pack
4 changes: 4 additions & 0 deletions .github/codeql/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
paths-ignore:
- node_modules
- dist
- lib
28 changes: 28 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
version: 2

updates:
- package-ecosystem: github-actions
directories:
- /
- .github/actions/generate-action-code
open-pull-requests-limit: 10
schedule:
interval: daily
time: '07:00'
timezone: Europe/Berlin
assignees:
- ffried
reviewers:
- ffried

- package-ecosystem: npm
directory: /
open-pull-requests-limit: 10
schedule:
interval: daily
time: '07:00'
timezone: Europe/Berlin
assignees:
- ffried
reviewers:
- ffried
21 changes: 21 additions & 0 deletions .github/workflows/actions_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Release GitHub Actions

on:
workflow_dispatch:
inputs:
tag:
description: "Tag for the release"
required: true

permissions:
contents: read

jobs:
release:
permissions:
actions: read
id-token: write
contents: write
uses: step-security/reusable-workflows/.github/workflows/actions_release.yaml@v1
with:
tag: "${{ github.event.inputs.tag }}"
54 changes: 54 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: CodeQL

on:
push:
branches: [ main ]
paths-ignore: [ 'dist/*.js' ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]
schedule:
- cron: '15 11 * * 1'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'javascript' ]

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

- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
config-file: ./.github/codeql/config.yml
languages: ${{ matrix.language }}

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

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
29 changes: 29 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Deploy Action Code

on:
push:
branches: [ main ]
paths-ignore: [ 'dist/*.js' ]

jobs:
deploy-action-code:
name: Deploy Action Code
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.BOT_TOKEN }}
- uses: ./.github/actions/generate-action-code
- name: Configure repository
env:
BOT_USERNAME: ${{ secrets.BOT_USERNAME }}
run: |
git config user.name "${BOT_USERNAME}"
git config user.email "${BOT_USERNAME}@users.noreply.github.com"
- name: Commit changes
run: |
if ! git diff --exit-code --quiet; then
git add .
git commit -m '[AUTO] Update generated code'
git push
fi
18 changes: 18 additions & 0 deletions .github/workflows/enable-auto-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Auto-merge for Dependabot PRs

on: pull_request

permissions:
contents: write
pull-requests: write

jobs:
enable-auto-merge:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- name: Enable auto-merge
run: gh pr merge --auto --rebase "${PR_URL}"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
17 changes: 17 additions & 0 deletions .github/workflows/tag-update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Update Release Tags

on:
release:
types: [ published ]

jobs:
update-tags:
if: ${{ !github.event.release.prerelease }}
name: Update Running Releases
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: sersoft-gmbh/running-release-tags-action@v3
with:
update-full-release: true
github-token: ${{ secrets.GITHUB_TOKEN }}
135 changes: 135 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
name: Tests

on:
push:
branches: [ main ]
paths:
- 'dist/*.js'
- '.github/workflows/tests.yml'
pull_request:
branches: [ main ]

jobs:
test-specific-version:
name: Test Specific Version
strategy:
matrix:
version: [ '2.26.1', '2.49.0' ]
os: [ 'ubuntu-latest', 'macos-latest', 'windows-latest' ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Generate action code
if: ${{ github.event_name == 'pull_request' }}
uses: ./.github/actions/generate-action-code
- uses: sersoft-gmbh/setup-gh-cli-action@main
if: ${{ github.event_name == 'push' }}
id: install-gh-main
with:
version: ${{ matrix.version }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- uses: './'
if: ${{ github.event_name == 'pull_request' }}
id: install-gh-local
with:
version: ${{ matrix.version }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- id: install-gh
shell: bash
env:
EVENT_NAME: ${{ github.event_name }}
BRANCH_INSTALLED_VERSION: ${{ steps.install-gh-main.outputs.installed-version }}
LOCAL_INSTALLED_VERSION: ${{ steps.install-gh-local.outputs.installed-version }}
run: |
if [ "${EVENT_NAME}" == 'push' ]; then
echo "installed-version=${BRANCH_INSTALLED_VERSION}" >> "${GITHUB_OUTPUT}"
else
echo "installed-version=${LOCAL_INSTALLED_VERSION}" >> "${GITHUB_OUTPUT}"
fi
- name: Check installed version
env:
REQUESTED_VERSION: ${{ matrix.version }}
INSTALLED_VERSION: ${{ steps.install-gh.outputs.installed-version }}
shell: bash
run: |
gh version | grep -q "${REQUESTED_VERSION}"
gh version | grep -q "${INSTALLED_VERSION}"
test-rolling-version:
name: Test Rolling Version
strategy:
matrix:
version: [ 'stable', 'latest' ]
os: [ 'ubuntu-latest', 'macos-latest', 'windows-latest' ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Generate action code
if: ${{ github.event_name == 'pull_request' }}
uses: ./.github/actions/generate-action-code
- uses: sersoft-gmbh/setup-gh-cli-action@main
if: ${{ github.event_name == 'push' }}
id: install-gh-main
with:
version: ${{ matrix.version }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- uses: './'
if: ${{ github.event_name == 'pull_request' }}
id: install-gh-local
with:
version: ${{ matrix.version }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- id: install-gh
shell: bash
env:
EVENT_NAME: ${{ github.event_name }}
BRANCH_INSTALLED_VERSION: ${{ steps.install-gh-main.outputs.installed-version }}
LOCAL_INSTALLED_VERSION: ${{ steps.install-gh-local.outputs.installed-version }}
run: |
if [ "${EVENT_NAME}" == 'push' ]; then
echo "installed-version=${BRANCH_INSTALLED_VERSION}" >> "${GITHUB_OUTPUT}"
else
echo "installed-version=${LOCAL_INSTALLED_VERSION}" >> "${GITHUB_OUTPUT}"
fi
- name: Check installed version
shell: bash
env:
REQUESTED_VERSION: ${{ matrix.version }}
INSTALLED_VERSION: ${{ steps.install-gh.outputs.installed-version }}
run: gh version | grep -q "${INSTALLED_VERSION}"

test-no-token:
name: Test without token
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Generate action code
if: ${{ github.event_name == 'pull_request' }}
uses: ./.github/actions/generate-action-code
- uses: sersoft-gmbh/setup-gh-cli-action@main
if: ${{ github.event_name == 'push' }}
id: install-gh-main
with:
version: stable
- uses: './'
if: ${{ github.event_name == 'pull_request' }}
id: install-gh-local
with:
version: stable
- id: install-gh
env:
EVENT_NAME: ${{ github.event_name }}
BRANCH_INSTALLED_VERSION: ${{ steps.install-gh-main.outputs.installed-version }}
LOCAL_INSTALLED_VERSION: ${{ steps.install-gh-local.outputs.installed-version }}
shell: bash
run: |
if [ "${EVENT_NAME}" == 'push' ]; then
echo "installed-version=${BRANCH_INSTALLED_VERSION}" >> "${GITHUB_OUTPUT}"
else
echo "installed-version=${LOCAL_INSTALLED_VERSION}" >> "${GITHUB_OUTPUT}"
fi
- name: Check installed version
shell: bash
env:
INSTALLED_VERSION: ${{ steps.install-gh.outputs.installed-version }}
run: gh version | grep -q "${INSTALLED_VERSION}"
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.DS_Store

.idea/

node_modules/

# Lib is just temporary - so we ignore it
lib/
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2024 StepSecurity

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Loading

0 comments on commit a725c3a

Please sign in to comment.