{"id":16179300,"url":"https://github.com/jonashackt/custom-github-action","last_synced_at":"2026-02-15T08:34:20.239Z","repository":{"id":147269454,"uuid":"349343444","full_name":"jonashackt/custom-github-action","owner":"jonashackt","description":"Project showing how to create \u0026 use your own GitHub Action","archived":false,"fork":false,"pushed_at":"2021-03-19T10:54:38.000Z","size":295,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-10T09:09:00.666Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"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/jonashackt.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":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-03-19T07:55:41.000Z","updated_at":"2021-03-26T08:25:46.000Z","dependencies_parsed_at":null,"dependency_job_id":"ef372f92-b8aa-4b81-9adb-b7b8487a860c","html_url":"https://github.com/jonashackt/custom-github-action","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jonashackt/custom-github-action","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonashackt%2Fcustom-github-action","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonashackt%2Fcustom-github-action/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonashackt%2Fcustom-github-action/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonashackt%2Fcustom-github-action/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jonashackt","download_url":"https://codeload.github.com/jonashackt/custom-github-action/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonashackt%2Fcustom-github-action/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29473718,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-15T06:58:05.414Z","status":"ssl_error","status_checked_at":"2026-02-15T06:58:05.085Z","response_time":118,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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-10-10T05:26:41.135Z","updated_at":"2026-02-15T08:34:20.209Z","avatar_url":"https://github.com/jonashackt.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# custom-github-action\nProject showing how to create \u0026amp; use your own GitHub Action\n\n\n## 1. Create a custom GitHub Action\n\nIn order to reuse GitHub Actions workflow snippets let's create a custom GitHub Action (see https://docs.github.com/en/actions/creating-actions/about-actions).\n\nAs we need some sort of example, let's use the https://github.com/jonashackt/spring-boot-buildpack project, which uses the following [GitHub Action workflow](https://github.com/jonashackt/spring-boot-buildpack/blob/main/.github/workflows/build.yml) - which is also referred to on stackoverflow https://stackoverflow.com/questions/66598692/cache-cloud-native-buildpacks-paketo-io-pack-cli-builds-on-github-actions-e-g/66598693#66598693:\n\n```yaml\nname: build\n\non: [push]\n\njobs:\n  build-with-paketo-push-2-dockerhub:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v2\n\n      - name: Login to DockerHub Container Registry\n        run: echo $DOCKER_HUB_TOKEN | docker login -u jonashackt --password-stdin\n        env:\n          DOCKER_HUB_TOKEN: ${{ secrets.DOCKER_HUB_TOKEN }}\n\n      - name: Install pack CLI via the official buildpack Action https://github.com/buildpacks/github-actions#setup-pack-cli-action\n        uses: buildpacks/github-actions/setup-pack@v4.1.0\n\n      - name: Build app with pack CLI using Buildpack Cache image (see https://buildpacks.io/docs/app-developer-guide/using-cache-image/) \u0026 publish to Docker Hub\n        run: |\n          pack build index.docker.io/jonashackt/spring-boot-buildpack:latest \\\n              --builder paketobuildpacks/builder:base \\\n              --path . \\\n              --cache-image index.docker.io/jonashackt/spring-boot-buildpack-paketo-cache-image:latest \\\n              --publish\n```\n\nSo the idea is to create a custom GitHub Action that does all the 3 steps of logging into a container registry, installing Paketo.io pack CLI and building with pack CLI in one step.\n\n\n### Create GitHub repository for your GitHub Action\n\nTherefore let's create a new repository for our GitHub Action:\n\n![create-github-repository](screenshots/create-github-repository.png)\n\nNow we clone the repo and create a action metadata file. But how to...\n\n\n### Do multiple steps inside one Action\n\nThere's the `composite run steps action` feature https://docs.github.com/en/actions/creating-actions/creating-a-composite-run-steps-action, which was announced here https://github.com/actions/runner/issues/646:\n\n\u003e We’ve also heard from our community that many developers want to reuse parts of their workflows into other workflows. This new action type, composite run steps, can help developers do just that!\n\nSo using multiple steps inside one Action could be achieved using the `using: \"composite\"` configuration parameter inside an Action:\n\n```yaml\nruns:\n  using: \"composite\"\n  steps:\n    - run: echo Hello ${{ inputs.who-to-greet }}.\n      shell: bash\n    - run: ${{ github.action_path }}/goodbye.sh\n      shell: bash\n```\n\n\n### Reuse an Action from a custom Action?\n\nhttps://stackoverflow.com/questions/58860769/call-a-github-action-from-another-github-action\n\nhttps://stackoverflow.com/questions/58611841/how-can-i-reference-other-actions-from-my-github-actions-action-yml-file\n\nThis feature is still under development and should be released somewhere in 2021:\n\nhttps://github.com/actions/runner/issues/646\n\n\u003e So right now, we can reuse other Actions inside our Action :(\n\n\n### Create action.yml\n\nLet's finally create the `action.yml` (see https://docs.github.com/en/actions/creating-actions/creating-a-composite-run-steps-action#creating-an-action-metadata-file):\n\n```yaml\nname:        'Paketo Build with pack CLI \u0026 push to registry'\ndescription: 'Build and publish OCI container image using Cloud Native Buildpacks / Paketo.io in GitHub Actions'\nauthor:      'jonas.hecht@codecentric.de'\n\ninputs:\n  pack-version:\n    description: 'The version of pack to install'\n    required:    false\n    default:     '0.17.0'\n\nruns:\n  using: \"composite\"\n  steps:\n    # Reusing the great pack CLI installation from https://github.com/buildpacks/github-actions/blob/main/setup-pack/action.yml\n    # As of https://github.com/actions/runner/issues/646 we can't simply reuse the Action, but if thats possible, we should do it :)\n    - name: Setup pack CLI\n      shell: bash\n      run:   |\n        #!/usr/bin/env bash\n        set -euo pipefail\n        mkdir -p \"${HOME}\"/bin\n        echo \"PATH=${HOME}/bin:${PATH}\" \u003e\u003e \"${GITHUB_ENV}\"\n        PACK_VERSION=${{ inputs.pack-version }}\n        echo \"Installing pack ${PACK_VERSION}\"\n        curl \\\n          --show-error \\\n          --silent \\\n          --location \\\n          \"https://github.com/buildpacks/pack/releases/download/v${PACK_VERSION}/pack-v${PACK_VERSION}-linux.tgz\" \\\n        | tar -C \"${HOME}/bin\" -xz pack\n    - name: Say hello\n      shell: bash\n      run: echo \"pack CLI is ready now!\"\n```\n\n### Releasing and Testing our Action \n\nhttps://docs.github.com/en/actions/creating-actions/about-actions#choosing-a-location-for-your-action\n\n\n\n\n\n\n\n\n\n\n\n\n## How to reuse GitHub Action workflows - or have private Actions\n\nGitHub Actions Centrally managed workflow templates feature: https://github.com/github/roadmap/issues/98\n\nhttps://stackoverflow.com/questions/60544181/how-to-us-snippets-in-github-action-workflow-file-to-avoid-duplicates\n\nWhy not use the actions/checkout Action to checkout the repository itself - and then also another repository containing an Action\n\nhttps://github.com/actions/checkout#checkout-multiple-repos-side-by-side\n\n\nand then use https://docs.github.com/en/actions/creating-actions/about-actions#choosing-a-location-for-your-action\n\nwith\n\n\u003e If you're building an action that you don't plan to make available to the public, you can store the action's files in any location in your repository. If you plan to combine action, workflow, and application code in a single repository, we recommend storing actions in the .github directory. For example, .github/actions/action-a and .github/actions/action-b.\n\n```\njobs:\n  my_first_job:\n    steps:\n\t\t- name: Checkout\n\t\t  uses: actions/checkout@v2\n\t\t  with:\n\t\t    path: main\n\n\t\t- name: Checkout tools repo\n\t\t  uses: actions/checkout@v2\n\t\t  with:\n\t\t    repository: my-org/my-tools\n\t\t    path: my-tools\n\n\t\t- name: Use local my-action\n\t\tuses: ./.github/actions/my-action\n\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonashackt%2Fcustom-github-action","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjonashackt%2Fcustom-github-action","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonashackt%2Fcustom-github-action/lists"}