Skip to content

Commit

Permalink
ci: use renovate, update CI and precommit and automate docs
Browse files Browse the repository at this point in the history
  • Loading branch information
tagoro9 committed Jul 5, 2024
1 parent 46d1a07 commit cbdf548
Show file tree
Hide file tree
Showing 10 changed files with 201 additions and 66 deletions.
6 changes: 0 additions & 6 deletions .github/dependabot.yaml

This file was deleted.

6 changes: 3 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ name: CI

on:
pull_request:
push:
branches: [main]

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: open-turo/actions-gha/lint@v1
- uses: open-turo/actions-gha/lint@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

Expand All @@ -18,8 +19,7 @@ jobs:
runs-on: ubuntu-latest
needs: [test-upload, test-download]
steps:
# This test is for node-based actions, we want to test our actions
- uses: open-turo/actions-gha/test@v1
- uses: open-turo/actions-gha/test@v2
with:
checkout-repo: true
github-token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ jobs:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: open-turo/actions-gha/lint@v1
- uses: open-turo/actions-gha/lint@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: open-turo/actions-gha/test@v1
- uses: open-turo/actions-gha/test@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

Expand All @@ -28,6 +28,6 @@ jobs:
name: Release
runs-on: ubuntu-latest
steps:
- uses: open-turo/actions-gha/release@v1
- uses: open-turo/actions-gha/release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25 changes: 25 additions & 0 deletions .github/workflows/update-dependencies.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Update dependencies
concurrency: update-dependencies

on:
schedule:
# Every day at midnight
- cron: "0 0 * * *"
workflow_dispatch:
issue_comment:
types:
- edited
pull_request:
types:
- edited

jobs:
update-dependencies:
runs-on: ubuntu-latest
name: Update dependencies
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: open-turo/action-renovate@v1
with:
github-token: ${{ secrets.OPEN_TURO_GITHUB_TOKEN }}
22 changes: 15 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,26 +1,34 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0 # Use the ref you want to point at
rev: v4.6.0 # Use the ref you want to point at
hooks:
- id: check-json
- id: check-yaml
- id: pretty-format-json
args:
- --autofix
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/pre-commit/mirrors-eslint
rev: v9.6.0
hooks:
- id: eslint
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.5.1
rev: v3.1.0
hooks:
- id: prettier
stages: [commit]
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
rev: v8.0.0
rev: v9.16.0
hooks:
- id: commitlint
stages: [commit-msg]
additional_dependencies: ["@open-turo/commitlint-config-conventional"]
- repo: https://github.com/rhysd/actionlint
rev: v1.6.8
rev: v1.7.1
hooks:
- id: actionlint
- repo: local
hooks:
- id: update-action-readme
name: update-action-readme
entry: ./script/update-action-readme
language: script
files: '.*action\.yaml$'
14 changes: 1 addition & 13 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
{
"branches": [
"main",
{
"channel": "next",
"name": "(f|b|c)/*",
"prerelease": "beta-<%= (/^\\w+-\\d+/.exec(name.substr(2)) || [])[0] %>"
}
],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/github"
]
"extends": "@open-turo/semantic-release-config"
}
Empty file removed action.yaml
Empty file.
87 changes: 69 additions & 18 deletions download/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# Github Action S3 Artifact Download

This action downloads a file or directory from an S3 bucket.
<!-- prettier-ignore-start -->
<!-- action-docs-description -->

## Description

GitHub Action that builds Node based repository

<!-- prettier-ignore-end -->

## Usage

Expand Down Expand Up @@ -127,25 +134,69 @@ This example shows how to make a passthrough failure download attempt.
not-found: ignore
```
<!-- prettier-ignore-start -->
<!-- action-docs-inputs source="action.yaml" -->
## Inputs
| parameter | description | required | default |
| --------------------- | ------------------------------------------------------------- | -------- | --------- |
| path | Path to download artifacts to | `false` | . |
| strip | Strip leading path components from downloaded artifacts | `false` | |
| s3uri | S3 uri to artifact to download | `true` | |
| not-found | What to do if the artifact is not found (error, warn, ignore) | `false` | error |
| aws-access-key-id | AWS access key ID of the S3 location | `false` | |
| aws-secret-access-key | AWS secret access key ID of the S3 location | `false` | |
| aws-region | AWS region of the S3 location | `false` | us-east-1 |

## Outputs

| parameter | description |
| --------- | -------------------------------------------- |
| s3uri | S3 URL for uploaded artifact |
| success | Whether the artifact download was successful |

| parameter | description | required | default |
| --- | --- | --- | --- |
| checkout-repo | Perform checkout as first step of action | `false` | true |
| build-script | Custom script to run, should be defined in package.json. | `false` | build |
| github-token | GitHub token that can checkout the repository. e.g. 'secrets.GITHUB_TOKEN' | `true` | ${{ github.token }} |
| npm-auth-token | The Node Package Manager (npm) authentication token. This token is used to authenticate against a private NPM registry configured via a .npmrc file. | `false` | |
| npm-token | The Node Package Manager (npm) authentication token. This token is used to authenticate against the NPM registry. | `false` | |
<!-- action-docs-outputs source="action.yaml" -->
<!-- action-docs-runs source="action.yaml" -->
## Runs

This action is a `composite` action.
<!-- action-docs-usage source="action.yaml" -->
## Usage

```yaml
- uses: @
with:
path:
# Path to download artifacts to
#
# Required: false
# Default: .
strip:
# Strip leading path components from downloaded artifacts
#
# Required: false
# Default: ""
s3uri:
# S3 uri to artifact to download
#
# Required: true
# Default: ""
not-found:
# What to do if the artifact is not found (error, warn, ignore)
#
# Required: false
# Default: error
aws-access-key-id:
# AWS access key ID of the S3 location
#
# Required: false
# Default: ""
aws-secret-access-key:
# AWS secret access key ID of the S3 location
#
# Required: false
# Default: ""
aws-region:
# AWS region of the S3 location
#
# Required: false
# Default: us-east-1
```
<!-- action-docs-usage source="action.yaml" -->
<!-- prettier-ignore-end -->
16 changes: 16 additions & 0 deletions script/update-action-readme
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash

set -e

for i in $*; do
# ignore if the file does not end with /action.yaml
if [[ "$i" != *"/action.yaml" ]]; then
echo "skipping: ${i}"
continue
fi

echo "npx action-docs --no-banner -s "${i}""
cd $(dirname "$i")
npx action-docs@2 --no-banner -s action.yaml -u README.md || echo "action-docs failed for $i"
cd -
done
85 changes: 69 additions & 16 deletions upload/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# Github Action S3 Artifact upload

This action uploads one or multiple files to an s3 uri location.
<!-- prettier-ignore-start -->
<!-- action-docs-description -->

## Description

GitHub Action that builds Node based repository

<!-- prettier-ignore-end -->

## Usage

Expand Down Expand Up @@ -91,23 +98,69 @@ key `YYYY-MM-DD` as name.
aws-region: ${{ secrets.AWS_REGION }}
```

<!-- prettier-ignore-start -->
<!-- action-docs-inputs source="action.yaml" -->
## Inputs

| parameter | description | required | default |
| --------------------- | ------------------------------------------------------------------ | -------- | -------------------------------------------------------------------- |
| path | Path(s) to the artifacts to upload | `true` | |
| s3uri | S3 url for bucket and path prefix of the artifact | `true` | |
| key | Artifact key name (a unique hash or timestamp or other identifier) | `false` | ${{ github.sha }}-${{ github.run_number }}-${{ github.run_attempt }} |
| aws-access-key-id | AWS access key ID of the S3 location | `false` | |
| aws-secret-access-key | AWS secret access key ID of the S3 location | `false` | |
| aws-region | AWS region of the S3 location | `false` | us-east-1 |

## Outputs

| parameter | description |
| --------- | ---------------------------- |
| s3uri | S3 URL for uploaded artifact |

| parameter | description | required | default |
| --- | --- | --- | --- |
| checkout-repo | Perform checkout as first step of action | `false` | true |
| build-script | Custom script to run, should be defined in package.json. | `false` | build |
| github-token | GitHub token that can checkout the repository. e.g. 'secrets.GITHUB_TOKEN' | `true` | ${{ github.token }} |
| npm-auth-token | The Node Package Manager (npm) authentication token. This token is used to authenticate against a private NPM registry configured via a .npmrc file. | `false` | |
| npm-token | The Node Package Manager (npm) authentication token. This token is used to authenticate against the NPM registry. | `false` | |
<!-- action-docs-outputs source="action.yaml" -->
<!-- action-docs-runs source="action.yaml" -->
## Runs

This action is a `composite` action.
<!-- action-docs-usage source="action.yaml" -->
## Usage

```yaml
- uses: @
with:
path:
# Path(s) to the artifacts to upload
#
# Required: true
# Default: ""
s3uri:
# S3 url for bucket and path prefix of the artifact
#
# Required: true
# Default: ""
key:
# Artifact key name (a unique hash or timestamp or other identifier)
#
# Required: false
# Default: ${{ github.sha }}-${{ github.run_number }}-${{ github.run_attempt }}
aws-access-key-id:
# AWS access key ID of the S3 location
#
# Required: false
# Default: ""
aws-secret-access-key:
# AWS secret access key ID of the S3 location
#
# Required: false
# Default: ""
aws-region:
# AWS region of the S3 location
#
# Required: false
# Default: us-east-1
compress:
# Whether to build a tarball of the artifacts before uploading
#
# Required: false
# Default: true
```
<!-- action-docs-usage source="action.yaml" -->
<!-- prettier-ignore-end -->

0 comments on commit cbdf548

Please sign in to comment.