{"id":15801540,"url":"https://github.com/dawitnida/packer-validate-action","last_synced_at":"2025-09-10T21:11:02.155Z","repository":{"id":65159475,"uuid":"179950311","full_name":"dawitnida/packer-validate-action","owner":"dawitnida","description":"Packer Validate GitHub Action","archived":false,"fork":false,"pushed_at":"2020-10-27T22:01:29.000Z","size":582,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-03-14T23:46:26.192Z","etag":null,"topics":["git","github-action","github-actions","hashicorp","hashicorp-packer","packer","packer-template","packer-validate"],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dawitnida.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}},"created_at":"2019-04-07T10:33:04.000Z","updated_at":"2021-03-11T15:52:19.000Z","dependencies_parsed_at":"2023-01-05T04:51:53.032Z","dependency_job_id":null,"html_url":"https://github.com/dawitnida/packer-validate-action","commit_stats":{"total_commits":11,"total_committers":2,"mean_commits":5.5,"dds":0.4545454545454546,"last_synced_commit":"165b51fdf98e74c302cc0b0b89c8181e9d279745"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dawitnida%2Fpacker-validate-action","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dawitnida%2Fpacker-validate-action/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dawitnida%2Fpacker-validate-action/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dawitnida%2Fpacker-validate-action/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dawitnida","download_url":"https://codeload.github.com/dawitnida/packer-validate-action/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246547327,"owners_count":20794970,"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":["git","github-action","github-actions","hashicorp","hashicorp-packer","packer","packer-template","packer-validate"],"created_at":"2024-10-05T01:23:08.166Z","updated_at":"2025-03-31T21:42:41.499Z","avatar_url":"https://github.com/dawitnida.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Packer Validate Action\n\nThese is unofficial Packer [GitHub Actions][github-actions] which allows you to run packer validation and inspection on \npull requests to review Packer template changes and potentially build on pull merge.\nCheck out the [official Packer documentation][packer-doc] for further reference. \n\nRuns `packer validate *.json` on pull request to validate the syntax and configuration of a template file in a directory\nIf the validation fails, it will print out error as pull request comment.\nCheck out the [packer validate command][packer-validate-doc] for further reference. \n\n## Usage\n\n### YAML style\n\nTo configure the action simply add the following lines to your .github/workflows/packer-validate.yml workflow file:\n\n```\nname: Validate packer template file in a directory\n\non:\n  pull_request:\njobs:\n  packer_validate:\n    runs-on: hashicorp/packer:1.6.4\n    steps:\n      - name: Packer validate template-y without argument\n        uses: dawitnida/packer-github-actions/validate@master\n        env:\n          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n          TEMPLATE_FILE_NAME: ${{ env.TEMPLATE_FILE_NAME }}\n```\n\n### Legacy\n\nTo check this in action, please check [Packer actions demo project][packer-actions-demo] with a collection\nof sample packer template files. \n\nVariables \n\n- `PACKER_ACTION_WORKING_DIR` : Working directory\n- `TEMPLATE_FILE_NAME` : Packer template file\n- `ACTION_COMMENT` : Enable/Disable PR comment from validate result\n\n```\nworkflow \"packer validate docker-image-template\" {\n  resolves = \"packer-validate-docker-image-template\"\n  on = \"pull_request\"\n}\n\naction \"filter-open-synced-pr\" {\n  uses = \"actions/bin/filter@master\"\n  args = \"action 'opened|synchronize'\"\n}\n\n# For single template (eg. dockers dir contains *.json template)\naction \"packer-validate-docker-image-template\" {\n  uses = \"dawitnida/packer-validate-action@master\"\n  needs = \"filter-open-synced-pr\"\n  secrets = [\n    \"GITHUB_TOKEN\",\n  ]\n  env = {\n    TEMPLATE_FILE_NAME = \"*.json\"\n    PACKER_ACTION_WORKING_DIR = \"dockers\"\n  }\n}\n\nworkflow \"packer validate template-x with var-file\" {\n  resolves = \"packer-validate-template-x\"\n  on = \"pull_request\"\n}\n\n# For specific template file (eg. packer-template-x.json) with var-file (global-vars.json) arg\naction \"packer-validate-template-x\" {\n  uses = \"dawitnida/packer-validate-action@master\"\n  needs = \"filter-open-synced-pr\"\n  secrets = [\n    \"GITHUB_TOKEN\",\n  ]\n  args = [\n    \"-var-file=global-vars.json\",\n  ]\n  env = {\n    TEMPLATE_FILE_NAME = \"packer-template-x.json\"\n  }\n}\n\nworkflow \"packer validate template-y without arg\" {\n  resolves = \"packer-validate-template-y\"\n  on = \"pull_request\"\n}\n\n# For specific template file (eg. packer-template-y.json) without any args\naction \"packer-validate-template-y\" {\n  uses = \"dawitnida/packer-validate-action@master\"\n  needs = \"filter-open-synced-pr\"\n  secrets = [\n    \"GITHUB_TOKEN\",\n  ]\n  env = {\n    TEMPLATE_FILE_NAME = \"packer-template-y.json\"\n  }\n}\n```\n\n**Figure 1.** *Packer validate without args failed with a comment*\n![failed-validation](assets/packer-template-y.png)\n\n**Figure 2.** *Packer validate success \u0026 failed outputs*\n![success-failed-output](assets/fail-success-validation.png)\n\n**Figure 3.** *Packer validate complete check list diagram*\n![checks-list-diagram](assets/action-results.png)\n\n\n## License\n\nThe Dockerfile and associated scripts and documentation in this project are released under the [Apache-2.0 License](LICENSE).\n\n### Author\n[Dawit Nida](https://github.com/dawitnida)\n\n[packer-validate-doc]:  \u003chttps://www.packer.io/docs/commands/validate.html\u003e\n[packer-actions-demo]:  \u003chttps://github.com/dawitnida/packer-actions-demo\u003e\n[github-actions]:       \u003chttps://github.com/features/actions\u003e\n[packer-doc]:           \u003chttps://www.packer.io/docs/index.html\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdawitnida%2Fpacker-validate-action","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdawitnida%2Fpacker-validate-action","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdawitnida%2Fpacker-validate-action/lists"}