Skip to content
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

release-->main #1

Merged
merged 5 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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: step-security/running-release-tags-action@v3
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is this workflow for? do we even have running-release-tags-action?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, my bad, removed

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: step-security/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: step-security/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: step-security/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.
33 changes: 32 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,32 @@
# setup-gh-cli-action
# Setup GH CLI Action


A GitHub action that installs or updates the `gh` CLI.

## Inputs

### `version`

The `gh` version to install.<br/>
Can also be set to `latest` to install the latest available version (including prereleases), or `stable` to install the latest stable release.<br/>
Defaults to `stable`.

### `github-token`

The token to use for retrieving the release. Can be set to `${{secrets.GITHUB_TOKEN}}`.<br/>
Use this if you hit rate limits.

## Outputs

### `full-version`

The full version was installed.


## Example Usage

```yaml
uses: step-security/setup-gh-cli-action@v2
with:
version: stable
```
5 changes: 5 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Security Policy

## Reporting a Vulnerability

Please report security vulnerabilities to [email protected]
20 changes: 20 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Setup GitHub CLI
description: Installs or updates the GitHub CLI (gh)
author: ser.soft GmbH
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

author?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

inputs:
version:
description: The `gh` version to install. Can also be set to `latest` to install the latest available version (including prereleases), or `stable` to install the latest stable release.
default: stable
required: true
github-token:
description: The token to use for retrieving the release. Can be set to `secrets.GITHUB_TOKEN`. Use this if you hit rate limits.
required: false
outputs:
installed-version:
description: The full version that was installed.
runs:
using: node20
main: dist/index.js
branding:
color: white
icon: terminal
Loading
Loading