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

Feature/container #170

Merged
merged 11 commits into from
Feb 8, 2021
Merged
Show file tree
Hide file tree
Changes from all 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
28 changes: 28 additions & 0 deletions .github/workflows/verify-on-container.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# https://help.github.com/en/articles/workflow-syntax-for-github-actions

name: Docker container on Ubuntu 20.04

on:
- push

jobs:
ssh:
name: Connect to github.com
runs-on: ubuntu-20.04
container: ubuntu:20.04
steps:
- name: Install packages
run: |
apt update
apt -y install openssh-client git
- name: Checkout source codes
uses: actions/checkout@v2
- name: Install SSH key
uses: ./.
with:
key: ${{ secrets.SSH_KEY }}
known_hosts: ${{ secrets.KNOWN_HOSTS }}
- name: print created files
run: ls -l /root/.ssh
- name: git clone through SSH
run: git clone git@github.com:shimataro/ssh-key-action.git tmp
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

### Added

* Support Docker container (thanks [@kujaomega](https://github.com/kujaomega))

### Changed

* Bundle dependencies (thanks [@tats-u](https://github.com/tats-u))
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
[![Ubuntu 20.04][image-verify-ubuntu-2004]][link-verify-ubuntu-2004]
[![Ubuntu 18.04][image-verify-ubuntu-1804]][link-verify-ubuntu-1804]
[![Ubuntu 16.04][image-verify-ubuntu-1604]][link-verify-ubuntu-1604]
[![Docker container][image-verify-docker-container]][link-verify-docker-container]
[![Release][image-release]][link-release]
[![License][image-license]][link-license]
[![Stars][image-stars]][link-stars]
Expand Down Expand Up @@ -144,6 +145,8 @@ See [CHANGELOG.md](CHANGELOG.md).
[link-verify-ubuntu-1804]: https://github.com/shimataro/ssh-key-action/actions?query=workflow%3A%22Ubuntu+18.04%22
[image-verify-ubuntu-1604]: https://github.com/shimataro/ssh-key-action/workflows/Ubuntu%2016.04/badge.svg?event=push&branch=v2
[link-verify-ubuntu-1604]: https://github.com/shimataro/ssh-key-action/actions?query=workflow%3A%22Ubuntu+16.04%22
[image-verify-docker-container]: https://github.com/shimataro/ssh-key-action/workflows/Docker%20container%20on%20Ubuntu%2020.04/badge.svg?event=push&branch=v2
[link-verify-docker-container]: https://github.com/shimataro/ssh-key-action/actions?query=workflow%3A%22Docker+container+on+Ubuntu+20.04%22
[image-release]: https://img.shields.io/github/release/shimataro/ssh-key-action.svg
[link-release]: https://github.com/shimataro/ssh-key-action/releases
[image-license]: https://img.shields.io/github/license/shimataro/ssh-key-action.svg
Expand Down
4 changes: 4 additions & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,10 @@ function getHomeDirectory() {
if (home === undefined) {
throw Error(`${homeEnv} is not defined`);
}
if (home === "/github/home") {
// Docker container
return "/root";
}
return home;
}
/**
Expand Down
6 changes: 6 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ function getHomeDirectory(): string
throw Error(`${homeEnv} is not defined`);
}

if(home === "/github/home")
{
// Docker container
return "/root";
}

return home;
}

Expand Down