All Projects → daspn → private-actions-checkout

daspn / private-actions-checkout

Licence: MIT license
GitHub Action to make custom private actions easily available to any workflow

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to private-actions-checkout

code-owner-self-merge
A GitHub Action for letting CODEOWNERS merge PRs via green PR reviews
Stars: ✭ 43 (-30.65%)
Mutual labels:  github-actions
PowerPlatform-ALM-With-GitHub-Template
Template repository for the ALM of Power Platform solutions with GitHub
Stars: ✭ 21 (-66.13%)
Mutual labels:  github-actions
setup-protoc
GitHub Action to setup the protoc compiler for protocol buffers
Stars: ✭ 58 (-6.45%)
Mutual labels:  github-actions
hasura-action
GitHub Action wrapping the Hasura CLI
Stars: ✭ 39 (-37.1%)
Mutual labels:  github-actions
notionproxy
Notion as a web site, inspired by react-notion-x.
Stars: ✭ 24 (-61.29%)
Mutual labels:  github-actions
branch-protection-bot
A bot tool to disable and re-enable "Include administrators" option in branch protection
Stars: ✭ 57 (-8.06%)
Mutual labels:  github-actions
cloudflare-dns-action
A GitHub action to set a DNS record using Cloudflare on push to the master branch.
Stars: ✭ 41 (-33.87%)
Mutual labels:  github-actions
django-template
The ultimate Django template: production ready Django 3.2 with Docker, HTTPS and CI/CD using Github actions ‎️‍🔥
Stars: ✭ 20 (-67.74%)
Mutual labels:  github-actions
action-ssh
GitHub Action for executing SSH commands on remote servers
Stars: ✭ 60 (-3.23%)
Mutual labels:  github-actions
pytest-github-actions-annotate-failures
Pytest plugin to annotate failed tests with a workflow command for GitHub Actions
Stars: ✭ 58 (-6.45%)
Mutual labels:  github-actions
wordpress-skeleton
A base repository structure for rtCamp's WordPress sites, pre-configured to use Github Actions
Stars: ✭ 32 (-48.39%)
Mutual labels:  github-actions
bx-github-ci
This tutorial provides one example on how a CI (Continuous Integration) workflow with the IAR Build Tools for Linux can be set up on GitHub. The IAR Build Tools on Linux are available for Arm, RISC-V and Renesas (RH850, RL78 and RX).
Stars: ✭ 20 (-67.74%)
Mutual labels:  github-actions
zola-deploy-action
Github action for building a Zola site and deploying to Github Pages
Stars: ✭ 131 (+111.29%)
Mutual labels:  github-actions
tarpaulin
📈 GitHub Action for code coverage reporting with tarpaulin
Stars: ✭ 69 (+11.29%)
Mutual labels:  github-actions
NextCommunity.github.io
Join FREE: Community of open-source programmers and software engineers.
Stars: ✭ 29 (-53.23%)
Mutual labels:  github-actions
mern-app
Basic MERN app template for AWS EC2 Deployment guide
Stars: ✭ 30 (-51.61%)
Mutual labels:  github-actions
gatsby-personal-site
My personal site made with Gatsby
Stars: ✭ 31 (-50%)
Mutual labels:  github-actions
link-snitch
GitHub Action to scan your site for broken links so you can fix them 🔗
Stars: ✭ 50 (-19.35%)
Mutual labels:  github-actions
noise-php
A starter-kit for your PHP project.
Stars: ✭ 52 (-16.13%)
Mutual labels:  github-actions
prettier
🔨 Native, blazingly-fast Prettier CLI on Github Actions
Stars: ✭ 19 (-69.35%)
Mutual labels:  github-actions

SSH Tests GitHub App tests

private-actions-checkout

Simplifies using custom private actions (and promotes code reuse) by looping through a list of repositories and checking them out into the job's workspace. Supports using GitHub Apps or multiple SSH keys.

Optionally configures git to allow subsequent steps to provide authenticated access private repos.

This actions is tested on ubuntu-20.04, ubuntu-18.04, macos-10.15. No Windows support yet.

Usage

Pre-requisites

Create a workflow .yml file in your repositories .github/workflows directory. An example workflow is available below. For more information, reference the GitHub Help Documentation for Creating a workflow file.

Supported authentications

To checkout private repositories we need a supported authentication accepted by the Git protocol. This action supports GitHub Apps and SSH keys.

For enterprise environments we recommend using a GitHub app per organization with 1 installation as it doesn't require having a machine account.

Inputs

  • actions_list - OPTIONAL: List of private actions to checkout. Must be a JSON array and each entry must match the format owner/repo@ref. May be an empty array if no actions are required.
  • checkout_base_path - OPTIONAL: Where to checkout the custom actions. It uses ./.github/actions as default path
  • return_app_token - OPTIONAL: If set to true then an output variable called app-token will be set that can be used for basic auth to github by subsequent steps (only works with Github Apps as the authentication method)
  • configure_git - OPTIONAL: If set to true then git config is executed to grant subsequent steps access to other private repos using the ssh or Github App token.

If you want to use GitHub Apps (recommended):

We support the key being plain and base64 encoded. To encode the private key you can use the following command: cat key.pem | base64 | tr -d \\n && echo

If you want to use SSH keys:

  • ssh_private_key - OPTIONAL: If provided, configures the ssh-agent with the given private key. If not provided the code assumes that valid SSH credentials are available to the git executable. If configure_git is enabled then the agent will be left running until the end of the job.

GitHub app requisites

If you want to use this action with a GitHub app you will need to setup some permissions. Follow the create GitHub app guide and check:

  • Repository permissions
    • Contents: read

Once it is created, install the GitHub app in your account or organization and grant access to the repositories that contain the actions you want to checkout (or all if you are not concerned the app has wide access in the account or org).

Example workflows

GitHub app

name: 'Example workflow'

on: push

jobs:
  example:
    runs-on: ubuntu-18.04

    steps:
    - uses: actions/checkout@v2

    - name: Private actions checkout
      uses: daspn/private-actions-checkout@v2
      with:
        actions_list: '["githubuser/my-private-action-1@v1", "githubuser/my-private-action-2@v1"]'
        checkout_base_path: ./.github/actions
        app_id: ${{ secrets.APP_ID }}
        app_private_key: ${{ secrets.APP_PRIVATE_KEY }}

    - name: Validation
      run: |
        ls -lR ./.github/actions

    # the custom private action will be available on the job's workspace
    - name: 'Using custom private action 1'
      uses: ./.github/actions/my-private-action-1
      with:
        some_arg: test

    - name: 'Using custom private action 2'
      uses: ./.github/actions/my-private-action-2

SSH

Single SSH key:

name: 'Example workflow'

on: push

jobs:
  example:
    runs-on: ubuntu-18.04

    steps:
    - uses: actions/checkout@v2

    - name: Private actions checkout
      uses: daspn/private-actions-checkout@v2
      with:
        actions_list: '["githubuser/my-private-action-1@v1", "githubuser/my-private-action-2@v1"]'
        checkout_base_path: ./.github/actions
        ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }}

    - name: Validation
      run: |
        ls -lR ./.github/actions

    # the custom private action will be available on the job's workspace
    - name: 'Using custom private action 1'
      uses: ./.github/actions/my-private-action-1
      with:
        some_arg: test

    - name: 'Using custom private action 2'
      uses: ./.github/actions/my-private-action-2

Multiple SSH keys workflow example:

name: 'Multiple SSH Keys workflow example'

on: push

jobs:
  example:
    runs-on: ubuntu-18.04

    steps:
    - uses: actions/checkout@v2

    - name: Checking out private actions from github_user
      uses: daspn/private-actions-checkout@v2
      with:
        actions_list: '["github_user/my-private-action-1@v1", "github_user/my-private-action-2@v1"]'
        checkout_base_path: ./.github/actions
        ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY_1 }}

    - name: Checking out private actions from another_github_user
      uses: daspn/private-actions-checkout@v2
      with:
        actions_list: '["another_github_user/my-private-action-3@v1", "another_github_user/my-private-action-4@v1"]'
        checkout_base_path: ./.github/actions
        ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY_2 }}

    - name: Validation
      run: |
        ls -lR ./.github/actions

    # the custom private action will be available on the job's workspace
    - name: 'Using custom private action 1'
      uses: ./.github/actions/my-private-action-1
      with:
        some_arg: test

    - name: 'Using custom private action 4'
      uses: ./.github/actions/my-private-action-4

No SSH Key example workflow:

name: 'No SSH Key example workflow'

on: push

jobs:
  example:
    runs-on: ubuntu-18.04

    steps:
    - uses: actions/checkout@v2

    # setting up the SSH agent using a third party action
    - uses: webfactory/[email protected]
      with:
        ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}

    # as no SSH key is provided the action will assume valid SSH credentials are available
    - name: Private actions checkout
      uses: daspn/private-actions-checkout@v2
      with:
        actions_list: '["githubuser/my-private-action-1@v1", "githubuser/my-private-action-2@v1"]'
        checkout_base_path: ./.github/actions

    - name: Validation
      run: |
        ls -lR ./.github/actions

    # the custom private action will be available on the job's workspace
    - name: 'Using custom private action 1'
      uses: ./.github/actions/my-private-action-1
      with:
        some_arg: test

    - name: 'Using custom private action 2'
      uses: ./.github/actions/my-private-action-2

GitHub App authorizing a Go application to fetch other private dependencies:

name: 'Example workflow'

on: push

jobs:
  example:
    runs-on: ubuntu-18.04

    steps:
    - uses: actions/checkout@v2

    - name: Private actions checkout
      uses: daspn/private-actions-checkout@v2
      with:
        app_id: ${{ secrets.APP_ID }}
        app_private_key: ${{ secrets.APP_PRIVATE_KEY }}
        configure_git: true

    - name: Set up Go
      uses: actions/setup-go@v2
      with:
        go-version: 1.15

    # Go build will be able to access other private repos authorized to the app
    - name: Build
      run: go build -v .

How to build

Local environment setup

To build this code, Node.js 12.x is required.

After installing Node.js 12.x, install the NPM package zeit/ncc by running:

npm i -g @zeit/ncc

Building the code

npm i
npm run build

This will update the dist/index.js and dist/cleanup/index.js files.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].