Compare commits
51 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8bcd8e1af3 | ||
|
|
8b502d2465 | ||
|
|
842595aafa | ||
|
|
2dbe6e60bc | ||
|
|
ff3b85c57f | ||
|
|
9268cfe5b4 | ||
|
|
9f96333901 | ||
|
|
72f033c275 | ||
|
|
f0c8dcb3c3 | ||
|
|
43190ae20e | ||
|
|
6afdcb1a83 | ||
|
|
773f6dbe05 | ||
|
|
66e612e94e | ||
|
|
0752cdfccd | ||
|
|
5fd24927d3 | ||
|
|
9f7ce46297 | ||
|
|
53f8e177e8 | ||
|
|
97c371b22c | ||
|
|
0335a4109c | ||
|
|
d075753879 | ||
|
|
a4403bff8a | ||
|
|
f92f69e492 | ||
|
|
84888ed472 | ||
|
|
71963a967c | ||
|
|
e01cee858b | ||
|
|
885a2b4891 | ||
|
|
290a125e98 | ||
|
|
3b5dba6d10 | ||
|
|
469a269999 | ||
|
|
211fd2c11a | ||
|
|
147b26dda6 | ||
|
|
6e7b362362 | ||
|
|
768e534a49 | ||
|
|
06cd4dd20d | ||
|
|
650de4f8a2 | ||
|
|
bf6227bf36 | ||
|
|
8b2413dfed | ||
|
|
7d6e75e1d8 | ||
|
|
9a98c7445b | ||
|
|
95836f602f | ||
|
|
3e89fcb2f1 | ||
|
|
77571553fd | ||
|
|
fa3159f173 | ||
|
|
5234986e11 | ||
|
|
d17ca00fba | ||
|
|
f4d919cc58 | ||
|
|
72fed7c8ea | ||
|
|
8525b07536 | ||
|
|
cf21239949 | ||
|
|
407d80e42d | ||
|
|
b90d85ff05 |
1
.gitattributes
vendored
Normal file
1
.gitattributes
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
* text=auto eol=lf
|
||||||
21
.github/dependabot.yml
vendored
Normal file
21
.github/dependabot.yml
vendored
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
version: 2
|
||||||
|
updates:
|
||||||
|
- package-ecosystem: docker
|
||||||
|
directory: /
|
||||||
|
schedule:
|
||||||
|
interval: weekly
|
||||||
|
groups:
|
||||||
|
docker-minor:
|
||||||
|
update-types:
|
||||||
|
- minor
|
||||||
|
- patch
|
||||||
|
|
||||||
|
- package-ecosystem: github-actions
|
||||||
|
directory: /
|
||||||
|
schedule:
|
||||||
|
interval: weekly
|
||||||
|
groups:
|
||||||
|
actions-minor:
|
||||||
|
update-types:
|
||||||
|
- minor
|
||||||
|
- patch
|
||||||
6
.github/linters/.checkov.yaml
vendored
Normal file
6
.github/linters/.checkov.yaml
vendored
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
quiet: true
|
||||||
|
skip-check:
|
||||||
|
# Ensure that HEALTHCHECK instructions have been added to container images
|
||||||
|
- CKV_DOCKER_2
|
||||||
|
# Ensure that a user for the container has been created
|
||||||
|
- CKV_DOCKER_3
|
||||||
7
.github/linters/.markdown-lint.yml
vendored
Normal file
7
.github/linters/.markdown-lint.yml
vendored
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
# Unordered list style
|
||||||
|
MD004:
|
||||||
|
style: dash
|
||||||
|
|
||||||
|
# Ordered list item prefix
|
||||||
|
MD029:
|
||||||
|
style: one
|
||||||
10
.github/linters/.yaml-lint.yml
vendored
Normal file
10
.github/linters/.yaml-lint.yml
vendored
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
rules:
|
||||||
|
document-end: disable
|
||||||
|
document-start:
|
||||||
|
level: warning
|
||||||
|
present: false
|
||||||
|
line-length:
|
||||||
|
level: warning
|
||||||
|
max: 80
|
||||||
|
allow-non-breakable-words: true
|
||||||
|
allow-non-breakable-inline-mappings: true
|
||||||
75
.github/workflows/ci.yml
vendored
Normal file
75
.github/workflows/ci.yml
vendored
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
name: Continuous Integration
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test-docker:
|
||||||
|
name: Docker Tests
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
# Run a local registry to push to
|
||||||
|
services:
|
||||||
|
registry:
|
||||||
|
image: registry:2
|
||||||
|
ports:
|
||||||
|
- 5001:5000
|
||||||
|
|
||||||
|
env:
|
||||||
|
TEST_TAG: localhost:5001/actions/hello-world-docer-action:latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
id: checkout
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
|
- name: Setup Docker BuildX
|
||||||
|
id: setup-buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
with:
|
||||||
|
install: true
|
||||||
|
driver-opts: network=host
|
||||||
|
|
||||||
|
- name: Build the Container
|
||||||
|
id: build
|
||||||
|
uses: docker/build-push-action@v6
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
push: true
|
||||||
|
tags: ${{ env.TEST_TAG }}
|
||||||
|
|
||||||
|
- name: Run the Container
|
||||||
|
id: run
|
||||||
|
env:
|
||||||
|
INPUT_WHO_TO_GREET: Mona Lisa Octocat
|
||||||
|
run: |
|
||||||
|
docker run \
|
||||||
|
--env INPUT_WHO_TO_GREET="${{ env.INPUT_WHO_TO_GREET }}" \
|
||||||
|
--rm ${{ env.TEST_TAG }}
|
||||||
|
|
||||||
|
test-action:
|
||||||
|
name: GitHub Actions Test
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
id: checkout
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
|
- name: Test Local Action
|
||||||
|
id: test-action
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
who-to-greet: Mona Lisa Octocat
|
||||||
|
|
||||||
|
- name: Print Output
|
||||||
|
id: output
|
||||||
|
run: echo "${{ steps.test-action.outputs.time }}"
|
||||||
37
.github/workflows/linter.yml
vendored
Normal file
37
.github/workflows/linter.yml
vendored
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
name: Lint Codebase
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: read
|
||||||
|
statuses: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
lint:
|
||||||
|
name: Lint Codebase
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
id: checkout
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Lint Codebase
|
||||||
|
id: super-linter
|
||||||
|
uses: super-linter/super-linter/slim@v8
|
||||||
|
env:
|
||||||
|
DEFAULT_BRANCH: main
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
VALIDATE_ALL_CODEBASE: true
|
||||||
|
VALIDATE_BIOME_FORMAT: false
|
||||||
|
VALIDATE_BIOME_LINT: false
|
||||||
|
VALIDATE_GITHUB_ACTIONS_ZIZMOR: false
|
||||||
25
.gitignore
vendored
Normal file
25
.gitignore
vendored
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
# Logs
|
||||||
|
logs
|
||||||
|
*.log
|
||||||
|
|
||||||
|
# Diagnostic reports (https://nodejs.org/api/report.html)
|
||||||
|
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
||||||
|
|
||||||
|
# Runtime data
|
||||||
|
pids
|
||||||
|
*.pid
|
||||||
|
*.seed
|
||||||
|
*.pid.lock
|
||||||
|
|
||||||
|
# dotenv environment variables file
|
||||||
|
.env
|
||||||
|
.env.test
|
||||||
|
|
||||||
|
# OS metadata
|
||||||
|
.DS_Store
|
||||||
|
Thumbs.db
|
||||||
|
|
||||||
|
# IDE files
|
||||||
|
.idea
|
||||||
|
.vscode
|
||||||
|
*.code-workspace
|
||||||
16
.prettierrc.json
Normal file
16
.prettierrc.json
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"printWidth": 80,
|
||||||
|
"tabWidth": 2,
|
||||||
|
"useTabs": false,
|
||||||
|
"semi": false,
|
||||||
|
"singleQuote": true,
|
||||||
|
"quoteProps": "as-needed",
|
||||||
|
"jsxSingleQuote": false,
|
||||||
|
"trailingComma": "none",
|
||||||
|
"bracketSpacing": true,
|
||||||
|
"bracketSameLine": true,
|
||||||
|
"arrowParens": "avoid",
|
||||||
|
"proseWrap": "always",
|
||||||
|
"htmlWhitespaceSensitivity": "css",
|
||||||
|
"endOfLine": "lf"
|
||||||
|
}
|
||||||
3
CODEOWNERS
Normal file
3
CODEOWNERS
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# Repository CODEOWNERS
|
||||||
|
|
||||||
|
* @actions/actions-oss-maintainers
|
||||||
22
Dockerfile
22
Dockerfile
@@ -1,8 +1,18 @@
|
|||||||
# Container image that runs your code
|
# Set the base image to use for subsequent instructions
|
||||||
FROM alpine:3.10
|
FROM alpine:3.23
|
||||||
|
|
||||||
# Copies your code file from your action repository to the filesystem path `/` of the container
|
# Set the working directory inside the container
|
||||||
COPY entrypoint.sh /entrypoint.sh
|
WORKDIR /usr/src
|
||||||
|
|
||||||
# Code file to execute when the docker container starts up (`entrypoint.sh`)
|
# Copy any source file(s) required for the action
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
COPY entrypoint.sh .
|
||||||
|
|
||||||
|
# Create a non-root user and switch to it
|
||||||
|
RUN addgroup -S actiongroup && adduser -S actionuser -G actiongroup && \
|
||||||
|
chown -R actionuser:actiongroup /usr/src && \
|
||||||
|
chmod +x /usr/src/entrypoint.sh
|
||||||
|
|
||||||
|
USER actionuser
|
||||||
|
|
||||||
|
# Configure the container to be run as an executable
|
||||||
|
ENTRYPOINT ["/usr/src/entrypoint.sh"]
|
||||||
|
|||||||
2
LICENSE
2
LICENSE
@@ -1,6 +1,6 @@
|
|||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2019 GitHub Actions
|
Copyright GitHub
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
112
README.md
112
README.md
@@ -1,23 +1,111 @@
|
|||||||
# Hello world docker action
|
# Hello, World! Docker Action
|
||||||
|
|
||||||
This action prints "Hello World" to the log or "Hello" + the name of a person to greet. To learn how this action was built, see "[Creating a Docker container action](https://docs.github.com/en/actions/creating-actions/creating-a-docker-container-action)" in the GitHub Docs.
|
[](https://github.com/super-linter/super-linter)
|
||||||
|

|
||||||
|
|
||||||
|
This action prints `Hello, World!` or `Hello, <who-to-greet>!` to the log. To
|
||||||
|
learn how this action was built, see
|
||||||
|
[Creating a Docker container action](https://docs.github.com/en/actions/creating-actions/creating-a-docker-container-action).
|
||||||
|
|
||||||
|
## Create Your Own Action
|
||||||
|
|
||||||
|
To create your own action, you can use this repository as a template! Just
|
||||||
|
follow the below instructions:
|
||||||
|
|
||||||
|
1. Click the **Use this template** button at the top of the repository
|
||||||
|
1. Select **Create a new repository**
|
||||||
|
1. Select an owner and name for your new repository
|
||||||
|
1. Click **Create repository**
|
||||||
|
1. Clone your new repository
|
||||||
|
|
||||||
|
> [!CAUTION]
|
||||||
|
>
|
||||||
|
> Make sure to remove or update the [`CODEOWNERS`](./CODEOWNERS) file! For
|
||||||
|
> details on how to use this file, see
|
||||||
|
> [About code owners](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners).
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
Here's an example of how to use this action in a workflow file:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
name: Example Workflow
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
who-to-greet:
|
||||||
|
description: Who to greet in the log
|
||||||
|
required: true
|
||||||
|
default: 'World'
|
||||||
|
type: string
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
say-hello:
|
||||||
|
name: Say Hello
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
# Change @main to a specific commit SHA or version tag, e.g.:
|
||||||
|
# actions/hello-world-docker-action@e76147da8e5c81eaf017dede5645551d4b94427b
|
||||||
|
# actions/hello-world-docker-action@v1.2.3
|
||||||
|
- name: Print to Log
|
||||||
|
id: print-to-log
|
||||||
|
uses: actions/hello-world-docker-action@main
|
||||||
|
with:
|
||||||
|
who-to-greet: ${{ inputs.who-to-greet }}
|
||||||
|
```
|
||||||
|
|
||||||
|
For example workflow runs, check out the
|
||||||
|
[Actions tab](https://github.com/actions/hello-world-docker-action/actions)!
|
||||||
|
:rocket:
|
||||||
|
|
||||||
## Inputs
|
## Inputs
|
||||||
|
|
||||||
### `who-to-greet`
|
| Input | Default | Description |
|
||||||
|
| -------------- | ------- | ------------------------------- |
|
||||||
**Required** The name of the person to greet. Default `"World"`.
|
| `who-to-greet` | `World` | The name of the person to greet |
|
||||||
|
|
||||||
## Outputs
|
## Outputs
|
||||||
|
|
||||||
### `time`
|
| Output | Description |
|
||||||
|
| ------ | ----------------------- |
|
||||||
|
| `time` | The time we greeted you |
|
||||||
|
|
||||||
The time we greeted you.
|
## Test Locally
|
||||||
|
|
||||||
## Example usage
|
After you've cloned the repository to your local machine or codespace, you'll
|
||||||
|
need to perform some initial setup steps before you can test your action.
|
||||||
|
|
||||||
```yaml
|
> [!NOTE]
|
||||||
uses: actions/hello-world-docker-action@main
|
>
|
||||||
with:
|
> You'll need to have a reasonably modern version of
|
||||||
who-to-greet: 'Mona the Octocat'
|
> [Docker](https://www.docker.com/get-started/) handy (e.g. docker engine
|
||||||
|
> version 20 or later).
|
||||||
|
|
||||||
|
1. :hammer_and_wrench: Build the container
|
||||||
|
|
||||||
|
Make sure to replace `actions/hello-world-docker-action` with an appropriate
|
||||||
|
label for your container.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker build -t actions/hello-world-docker-action .
|
||||||
|
```
|
||||||
|
|
||||||
|
1. :white_check_mark: Test the container
|
||||||
|
|
||||||
|
You can pass individual environment variables using the `--env` or `-e` flag.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker run --env INPUT_WHO_TO_GREET="Mona Lisa Octocat" actions/hello-world-docker-action
|
||||||
|
::notice file=entrypoint.sh,line=7::Hello, Mona Lisa Octocat!
|
||||||
|
```
|
||||||
|
|
||||||
|
Or you can pass a file with environment variables using `--env-file`.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ echo "INPUT_WHO_TO_GREET=\"Mona Lisa Octocat\"" > ./.env.test
|
||||||
|
|
||||||
|
$ docker run --env-file ./.env.test actions/hello-world-docker-action
|
||||||
|
::notice file=entrypoint.sh,line=7::Hello, Mona Lisa Octocat!
|
||||||
```
|
```
|
||||||
|
|||||||
28
action.yml
28
action.yml
@@ -1,15 +1,21 @@
|
|||||||
name: 'Hello World'
|
name: Hello, World!
|
||||||
description: 'Greet someone and record the time'
|
description: Greet someone and record the time
|
||||||
|
author: GitHub Actions
|
||||||
|
|
||||||
|
# Define your inputs here.
|
||||||
inputs:
|
inputs:
|
||||||
who-to-greet: # id of input
|
who-to-greet:
|
||||||
description: 'Who to greet'
|
description: Who to greet
|
||||||
required: true
|
required: true
|
||||||
default: 'World'
|
default: World
|
||||||
|
|
||||||
|
# Define your outputs here.
|
||||||
outputs:
|
outputs:
|
||||||
time: # id of output
|
time:
|
||||||
description: 'The time we greeted you'
|
description: The time we greeted you
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: 'docker'
|
using: docker
|
||||||
image: 'Dockerfile'
|
image: Dockerfile
|
||||||
args:
|
env:
|
||||||
- ${{ inputs.who-to-greet }}
|
INPUT_WHO_TO_GREET: ${{ inputs.who-to-greet }}
|
||||||
|
|||||||
@@ -1,5 +1,12 @@
|
|||||||
#!/bin/sh -l
|
#!/bin/sh -l
|
||||||
|
|
||||||
echo "Hello $1"
|
# Use INPUT_<INPUT_NAME> to get the value of an input
|
||||||
time=$(date)
|
GREETING="Hello, $INPUT_WHO_TO_GREET!"
|
||||||
echo "time=$time" >> $GITHUB_OUTPUT
|
|
||||||
|
# Use workflow commands to do things like set debug messages
|
||||||
|
echo "::notice file=entrypoint.sh,line=7::$GREETING"
|
||||||
|
|
||||||
|
# Write outputs to the $GITHUB_OUTPUT file
|
||||||
|
echo "time=$(date)" >>"$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
|||||||
Reference in New Issue
Block a user