Skip to content

Commit

Permalink
Merge pull request #27 from shawaj/patch-1
Browse files Browse the repository at this point in the history
feat: add optional auth token, fix deprecations and build with ncc
  • Loading branch information
neil-pozetroninc authored Feb 16, 2023
2 parents 06da55d + 87bf0df commit d1dafdb
Show file tree
Hide file tree
Showing 551 changed files with 9,886 additions and 212,591 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
###########################
###########################
## Linter GitHub Actions ##
###########################
###########################
name: Lint Code Base

#
# Documentation:
# https://help.github.com/en/articles/workflow-syntax-for-github-actions
#

#############################
# Start the job on all push #
#############################
on:
push:
pull_request:

###############
# Set the Job #
###############
jobs:
build:
# Name the Job
name: Lint Code Base
# Set the agent to run on
runs-on: ubuntu-latest

##################
# Load all steps #
##################
steps:
##########################
# Checkout the code base #
##########################
- name: Checkout Code
uses: actions/checkout@v3
with:
# Full git history is needed to get a proper list of changed files
# within `super-linter`
fetch-depth: 0

################################
# Run Linter against code base #
################################
- name: Lint Code Base
uses: github/super-linter/slim@v4
env:
VALIDATE_ALL_CODEBASE: true
VALIDATE_YAML: true
VALIDATE_GITHUB_ACTIONS: true
VALIDATE_JSON: true
VALIDATE_JAVASCRIPT_ES: true
DEFAULT_BRANCH: master
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32 changes: 32 additions & 0 deletions .github/workflows/ncc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
name: Build with ncc

on: [push]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.ref }}
- uses: actions/setup-node@v3
with:
node-version: 16
- name: Install npm and package
run: |
# Get github branch without refs
GITHUB_BRANCH=$( echo "${{ github.ref }}" | sed 's/refs\/heads\///g' )
echo "GITHUB_BRANCH=$GITHUB_BRANCH" >> "$GITHUB_ENV"
# Install npm, ncc and build
npm install
npm i -g @vercel/ncc
npm run package
- name: Push updated ncc build if available
uses: test-room-7/action-update-file@v1
with:
branch: ${{ env.GITHUB_BRANCH }}
file-path: dist/*
commit-msg: Update ncc build to latest version
github-token: ${{ secrets.GITHUB_TOKEN }}
30 changes: 23 additions & 7 deletions .github/workflows/workflow.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: Test
on: [push]

Expand All @@ -7,17 +8,32 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- run: npm i
- uses: ./
with:
repository: pozetroninc/github-action-get-latest-release
repository: pozetroninc/github-action-get-latest-release
- uses: ./
with:
owner: pozetroninc
repo: github-action-get-latest-release
owner: pozetroninc
repo: github-action-get-latest-release
- uses: ./
with:
owner: pozetroninc
repo: github-action-get-latest-release
excludes: prerelease, draft
owner: pozetroninc
repo: github-action-get-latest-release
excludes: prerelease, draft
- uses: ./
with:
repository: pozetroninc/github-action-get-latest-release
token: ${{ secrets.GITHUB_TOKEN }}
- uses: ./
with:
owner: pozetroninc
repo: github-action-get-latest-release
token: ${{ secrets.GITHUB_TOKEN }}
- uses: ./
with:
owner: pozetroninc
repo: github-action-get-latest-release
excludes: prerelease, draft
token: ${{ secrets.GITHUB_TOKEN }}
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,17 @@ repository | The repository name in full | pozetroninc/github-action-get-latest-
Name | Description | Example
--- | --- | ---
excludes | Exclude draft or pre-release versions. | "prerelease, draft"
token | GitHub token or personal access token | `${{ secrets.GITHUB_TOKEN }}` or `${{ secrets.PERSONAL_ACCESS_TOKEN }}`

Using the `GITHUB_TOKEN` will avoid the action [failing due to hitting API rate limits](https://github.com/pozetroninc/github-action-get-latest-release/issues/24) from the IP address of the GitHub runner your action is running on. Using a `PERSONAL_ACCESS_TOKEN` is required to get the release information from a private repo. You can read about [how to create a personal access token here](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token) and how to [add this as a repository secret here](https://docs.github.com/en/github/automating-your-workflow-with-github-actions/creating-and-using-encrypted-secrets).

**Outputs**

Name | Description | Example
--- | --- | ---
release | The latest release version tag | v0.3.0
id | The latest release version id | 12345
description | The latest release description body | This is an example release

Usage Example
=============
Expand All @@ -53,8 +57,8 @@ jobs:
uses: pozetroninc/github-action-get-latest-release@master
with:
repository: RedisTimeSeries/RedisTimeSeries
- uses: actions/checkout@v2
- uses: docker/build-push-action@v1
- uses: actions/checkout@v3
- uses: docker/build-push-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
Expand All @@ -70,3 +74,9 @@ To use the current repo:
with:
repository: ${{ github.repository }}
```
To use authentication token:
``` yaml
with:
token: ${{ secrets.GITHUB_TOKEN }}
```
14 changes: 11 additions & 3 deletions action.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
---
name: 'Get Latest Release'
description: 'Get the latest release from another repository and output that for use in other actions'
description: >-
Get the latest release from another repository and output that for use in
other actions
branding:
icon: 'anchor'
color: 'orange'
Expand All @@ -16,11 +19,16 @@ inputs:
excludes:
description: 'Types of releases to exclude (e.g. pre-release)'
required: false
token:
description: 'The GitHub token or personal access token'
required: false
outputs:
release:
description: 'Latest release name'
id:
description: 'Latest release ID'
description:
description: 'Latest release description body'
runs:
using: 'node12'
main: 'main.js'
using: 'node16'
main: 'dist/index.js'
Loading

0 comments on commit d1dafdb

Please sign in to comment.