{"id":13901262,"url":"https://github.com/actions/container-action","last_synced_at":"2025-04-12T23:39:49.741Z","repository":{"id":47436274,"uuid":"193558497","full_name":"actions/container-action","owner":"actions","description":null,"archived":false,"fork":false,"pushed_at":"2024-12-11T16:38:49.000Z","size":49,"stargazers_count":196,"open_issues_count":0,"forks_count":49,"subscribers_count":12,"default_branch":"main","last_synced_at":"2025-04-12T23:39:44.332Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/actions.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-06-24T18:29:56.000Z","updated_at":"2025-03-31T12:49:03.000Z","dependencies_parsed_at":"2023-12-05T16:27:00.171Z","dependency_job_id":"e6b1ec0f-f92c-4be0-8442-3c3fc4f54861","html_url":"https://github.com/actions/container-action","commit_stats":{"total_commits":42,"total_committers":6,"mean_commits":7.0,"dds":0.2857142857142857,"last_synced_commit":"8ac020e5dcb528876cbefe20fdc098dcba20a536"},"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/actions%2Fcontainer-action","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/actions%2Fcontainer-action/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/actions%2Fcontainer-action/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/actions%2Fcontainer-action/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/actions","download_url":"https://codeload.github.com/actions/container-action/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248647255,"owners_count":21139081,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-06T21:01:05.983Z","updated_at":"2025-04-12T23:39:49.719Z","avatar_url":"https://github.com/actions.png","language":"Shell","readme":"# Container Action Template\n\n[![GitHub Super-Linter](https://github.com/actions/container-action/actions/workflows/linter.yml/badge.svg)](https://github.com/super-linter/super-linter)\n![CI](https://github.com/actions/container-action/actions/workflows/ci.yml/badge.svg)\n\nUse this template to bootstrap the creation of a container action. :rocket:\n\nThis template includes compilation support, tests, a validation workflow,\npublishing, and versioning guidance.\n\nIf you are new, there's also a simpler introduction in the\n[Hello World Docker Action](https://github.com/actions/hello-world-docker-action)\nrepository.\n\nIf you would like to use the\n[GitHub Actions Toolkit](https://github.com/actions/toolkit) in your container\naction, see the\n[Container Toolkit Action](https://github.com/actions/container-toolkit-action)\nrepository.\n\n## Create Your Own Action\n\nTo create your own action, you can use this repository as a template! Just\nfollow the below instructions:\n\n1. Click the **Use this template** button at the top of the repository\n1. Select **Create a new repository**\n1. Select an owner and name for your new repository\n1. Click **Create repository**\n1. Clone your new repository\n\n\u003e [!IMPORTANT]\n\u003e\n\u003e Make sure to remove or update the [`CODEOWNERS`](./CODEOWNERS) file! For\n\u003e details on how to use this file, see\n\u003e [About code owners](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners).\n\n## Initial Setup\n\nAfter you've cloned the repository to your local machine or codespace, you'll\nneed to perform some initial setup steps before you can develop your action.\n\n\u003e [!NOTE]\n\u003e\n\u003e You'll need to have a reasonably modern version of\n\u003e [Docker](https://www.docker.com/get-started/) handy (e.g. docker engine\n\u003e version 20 or later).\n\n1. :hammer_and_wrench: Build the container\n\n   Make sure to replace `actions/container-action` with an appropriate label for\n   your container.\n\n   ```bash\n   docker build -t actions/container-action .\n   ```\n\n1. :white_check_mark: Test the container\n\n   You can pass individual environment variables using the `--env` or `-e` flag.\n\n   ```bash\n   $ docker run --env INPUT_WHO_TO_GREET=\"Mona Lisa Octocat\" actions/container-action\n   ::notice file=entrypoint.sh,line=7::Hello, Mona Lisa Octocat!\n   ```\n\n   Or you can pass a file with environment variables using `--env-file`.\n\n   ```bash\n   $ cat ./.env.test\n   INPUT_WHO_TO_GREET=\"Mona Lisa Octocat\"\n\n   $ docker run --env-file ./.env.test actions/container-action\n   ::notice file=entrypoint.sh,line=7::Hello, Mona Lisa Octocat!\n   ```\n\n## Update the Action Metadata\n\nThe [`action.yml`](action.yml) file defines metadata about your action, such as\ninput(s) and output(s). For details about this file, see\n[Metadata syntax for GitHub Actions](https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions).\n\nWhen you copy this repository, update `action.yml` with the name, description,\ninputs, and outputs for your action.\n\n## Update the Action Code\n\nIn this template, the container action runs a shell script,\n[`entrypoint.sh`](./entrypoint.sh), when the container is launched. Since you\ncan choose any base Docker image and language you like, you can change this to\nsuite your needs. There are a few main things to remember when writing code for\ncontainer actions:\n\n- Inputs are accessed using argument identifiers or environment variables\n  (depending on what you set in your `action.yml`). For example, the first input\n  to this action, `who-to-greet`, can be accessed in the entrypoint script using\n  the `$INPUT_WHO_TO_GREET` environment variable.\n\n  ```bash\n  GREETING=\"Hello, $INPUT_WHO_TO_GREET!\"\n  ```\n\n- GitHub Actions supports a number of different workflow commands such as\n  creating outputs, setting environment variables, and more. These are\n  accomplished by writing to different `GITHUB_*` environment variables. For\n  more information, see\n  [Workflow commands](https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions).\n\n  | Scenario              | Example                                         |\n  | --------------------- | ----------------------------------------------- |\n  | Set environment vars  | `echo \"MY_VAR=my-value\" \u003e\u003e \"$GITHUB_ENV\"`       |\n  | Set outputs           | `echo \"greeting=$GREETING\" \u003e\u003e \"$GITHUB_OUTPUT\"` |\n  | Prepend to `PATH`     | `echo \"$HOME/.local/bin\" \u003e\u003e \"$GITHUB_PATH\"`     |\n  | Set `pre`/`post` vars | `echo \"MY_VAR=my-value\" \u003e\u003e \"$GITHUB_STATE\"`     |\n  | Set step summary      | `echo \"{markdown}\" \u003e\u003e \"$GITHUB_STEP_SUMMARY\"`   |\n\n  You can write multiline strings using the following syntax:\n\n  ```bash\n  {\n    echo \"JSON_RESPONSE\u003c\u003cEOF\"\n    curl https://example.com\n    echo \"EOF\"\n  } \u003e\u003e \"$GITHUB_ENV\"\n  ```\n\n- Make sure that the script being run is executable!\n\n  ```bash\n  git add entrypoint.sh\n  git update-index --chmod=+x entrypoint.sh\n  ```\n\nSo, what are you waiting for? Go ahead and start customizing your action!\n\n1. Create a new branch\n\n   ```bash\n   git checkout -b releases/v1\n   ```\n\n1. Replace the contents of `entrypoint.sh` with your action code\n1. Build and test the container\n\n   ```bash\n   docker build -t actions/container-action .\n   docker run actions/container-action \"Mona Lisa Octocat\"\n   ```\n\n1. Commit your changes\n\n   ```bash\n   git add .\n   git commit -m \"My first action is ready!\"\n   ```\n\n1. Push them to your repository\n\n   ```bash\n   git push -u origin releases/v1\n   ```\n\n1. Create a pull request and get feedback on your action\n1. Merge the pull request into the `main` branch\n\nYour action is now published! :rocket:\n\nFor information about versioning your action, see\n[Versioning](https://github.com/actions/toolkit/blob/master/docs/action-versioning.md)\nin the GitHub Actions toolkit.\n\n## Validate the Action\n\nYou can now validate the action by referencing it in a workflow file. For\nexample, [`ci.yml`](./.github/workflows/ci.yml) demonstrates how to reference an\naction in the same repository.\n\n```yaml\nsteps:\n  - name: Checkout\n    id: checkout\n    uses: actions/checkout@v3\n\n  - name: Test Local Action\n    id: test-action\n    uses: ./\n    with:\n      who-to-greet: Mona Lisa Octocat\n\n  - name: Print Output\n    id: output\n    run: echo \"${{ steps.test-action.outputs.greeting }}\"\n```\n\nFor example workflow runs, check out the\n[Actions tab](https://github.com/actions/container-action/actions)! :rocket:\n\n## Usage\n\nAfter testing, you can create version tag(s) that developers can use to\nreference different stable versions of your action. For more information, see\n[Versioning](https://github.com/actions/toolkit/blob/master/docs/action-versioning.md)\nin the GitHub Actions toolkit.\n\nTo include the action in a workflow in another repository, you can use the\n`uses` syntax with the `@` symbol to reference a specific branch, tag, or commit\nhash.\n\n```yaml\nsteps:\n  - name: Checkout\n    id: checkout\n    uses: actions/checkout@v3\n\n  - name: Test Local Action\n    id: test-action\n    uses: actions/container-action@v1 # Commit with the `v1` tag\n    with:\n      who-to-greet: Mona Lisa Octocat\n\n  - name: Print Output\n    id: output\n    run: echo \"${{ steps.test-action.outputs.greeting }}\"\n```\n","funding_links":[],"categories":["Shell"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Factions%2Fcontainer-action","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Factions%2Fcontainer-action","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Factions%2Fcontainer-action/lists"}