{"id":19493588,"url":"https://github.com/datapane/build-action","last_synced_at":"2026-04-10T23:02:42.645Z","repository":{"id":65159462,"uuid":"301455686","full_name":"datapane/build-action","owner":"datapane","description":"Github Action to support building and publishing Datapane Reports","archived":false,"fork":false,"pushed_at":"2023-08-18T09:49:22.000Z","size":659,"stargazers_count":1,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-25T20:24:13.605Z","etag":null,"topics":["data-science","datapane","gh-action","python","report-workflows"],"latest_commit_sha":null,"homepage":"https://datapane.com","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/datapane.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2020-10-05T15:31:04.000Z","updated_at":"2021-02-03T22:40:15.000Z","dependencies_parsed_at":"2024-11-10T21:27:44.290Z","dependency_job_id":"18db3f23-be5f-4d6b-9cee-0660dbc3b9cd","html_url":"https://github.com/datapane/build-action","commit_stats":{"total_commits":92,"total_committers":3,"mean_commits":"30.666666666666668","dds":0.08695652173913049,"last_synced_commit":"a0956764d6794b2ba066c1513200196a28c901eb"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/datapane/build-action","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datapane%2Fbuild-action","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datapane%2Fbuild-action/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datapane%2Fbuild-action/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datapane%2Fbuild-action/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/datapane","download_url":"https://codeload.github.com/datapane/build-action/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datapane%2Fbuild-action/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264504615,"owners_count":23618831,"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":["data-science","datapane","gh-action","python","report-workflows"],"created_at":"2024-11-10T21:26:40.007Z","updated_at":"2026-04-10T23:02:37.623Z","avatar_url":"https://github.com/datapane.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# build-action\n\nGithub action for building a Datapane report.\n\n## Example Workflow\n\n```yaml\njobs:\n  build_report:\n    runs-on: ubuntu-latest\n    name: Build Datapane report\n    steps:\n      - uses: actions/checkout@v2\n      - uses: actions/setup-python@v1\n        with:\n          python-version: 3.8\n      - uses: datapane/build-action@v2\n        with:\n          script: \"reports/dp_script.py\"\n          token: ${{ secrets.TOKEN }}\n          parameters: '{\"foo\": \"bar\"}'\n```\n\n## Input Parameters\n\n| Name | Description | Default | \n|--|--|--|\n| script (required) | Python script/notebook to execute, relative to repo root  | None |\n| token | Datapane API token to use | None |\n| server | Datapane server to connect to | https://datapane.com |\n| parameters | Stringified JSON object of parameter key-value pairs | `\"{}\"`\n| requirements | Stringified JSON array of extra PyPI dependencies to install | `\"[]\"`\n| version | Version of Datapane to install, using pip specification, e.g. \"\u003e=0.8.0,\u003c0.9.0\" | None\n\nNote that all input parameters should be given as strings. Additionally, parameters are not currently supported when running Jupyter Notebooks - for now please convert to a Python script first.\n\n\n## Running your Workflow\n\nYou can use the GH Action to run your report workflow upon git repo changes, for instance on every commit, on certain branches, etc., as specified in the [docs]().\n\nHowever it's also possible to run report workflows on a schedule (for instance every week), or manually, either via the GH Action UI or in response to a webhook, in both cases with the ability to dynamically set report parameters.\n\n\n### Scheduled runs\n\nScheduled runs can be used to update a report on a regular cadence, e.g. every week, and will show up as a new version of the report in Datapane.\n\nGH Actions support scheduling a workflow to run using a cron syntax, as described [here](https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows#scheduled-events).\n\nFor instance, to run our weekly reports on every Friday afternoon,\n\n```yaml\non:\n  schedule:\n    # run at 5pm every Friday\n    - cron:  '00 17 * * 5'\njobs:\n  build_report:\n    runs-on: ubuntu-latest\n    name: Run end-of-week Datapane reports\n    steps:\n      - uses: actions/checkout@v2\n      - uses: actions/setup-python@v1\n        with:\n          python-version: 3.8\n      - uses: datapane/build-action@v2\n        with:\n          script: \"reports/end_of_week.py\"\n          token: ${{ secrets.TOKEN }}\n```\n\n\n### Manual runs\n\n\nIf your report has user-configurable parameters, you can define these in your workflow and enter them via the GH Action site when manually triggering your workflow.\n\nThe parameters in the GH Action UI are all strings, however Datapane will convert them to primitive values as needed, e.g. the string `false` becomes a python boolean `False` value. Th\n\nWorkflow parameters are described in the [docs](https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows#workflow_dispatch). The input must manually be converted to the `parameters` json string to pass to the Datapane `build-action` as follows.\n\n\n```yaml\non:\n  workflow_dispatch:\n    inputs:\n      company:\n        description: 'Company stock name'\n        required: true\n        default: 'GOOG'\n      market:\n        description: 'Country to report for'\n        required: false\njobs:\n  build_report:\n    runs-on: ubuntu-latest\n    name: Run Parameterised Datapane report\n    steps:\n      - uses: actions/checkout@v2\n      - uses: actions/setup-python@v1\n        with:\n          python-version: 3.8\n      - uses: datapane/build-action@v2\n        with:\n          script: \"reports/financials.py\"\n          token: ${{ secrets.TOKEN }}\n          parameters: ${{ toJson(github.event.inputs) }}\n```\n\n#### Trigger by Github UI\n\nSee GH [docs](https://docs.github.com/en/free-pro-team@latest/actions/managing-workflow-runs/manually-running-a-workflow#running-a-workflow-on-github) for running a parameterised datapane workflow using the GH Action UI.\n\n\n#### Trigger by API/Webhook\n\nSee GH [docs](https://docs.github.com/en/free-pro-team@latest/rest/reference/actions#create-a-workflow-dispatch-event) for running a parameterised datapane workflow via an API Call.\n\nEssentially, you need to send a POST request to `/repos/{owner}/{repo}/actions/workflows/{workflow_name}/dispatches`. So for a repo called `acme/reporting`, with a workflow as above called `financial_report` the following would work,\n\n```bash\n$ curl \\\n  -u GH_USERNAME:GH_TOKEN \\\n  -X POST \\\n  -H \"Accept: application/vnd.github.v3+json\" \\\n  https://api.github.com/repos/acme/reporting/actions/workflows/financial_report/dispatches \\\n  -d '{\"ref\":\"ref\", \"inputs\": { \"company\": \"APPL\", \"market\": \"UK\"} }'\n```\n\n## Advanced Usage\n\n### Caching\n\n#### Caching pip\n\nPip dependencies can be cached via [actions/cache](https://docs.github.com/en/free-pro-team@latest/actions/guides/building-and-testing-python#caching-dependencies).\nThe cache key should contain the `requirements` and `version` input parameters, if they're used. \n\nAn example workflow on Ubuntu with caching is shown below:\n\n```yaml\nenv:\n  version: \"==0.8.0\"\n  requirements: '[\"networkx\"]'\njobs:\n  build_report:\n    runs-on: ubuntu-latest\n    name: Build Datapane report\n    steps:\n      - uses: actions/checkout@v2\n      - uses: actions/setup-python@v1\n        with:\n          python-version: 3.8\n      - uses: actions/cache@v2\n        with:\n          path: ~/.cache/pip\n          key: ${{ runner.os }}-pip-${{ env.requirements }}-${{ env.version }}\n      - uses: datapane/build-action@v2\n        with:\n          script: \"reports/financials.py\"\n          token: ${{ secrets.TOKEN }}\n          version: \"${{ env.version }}\"\n          requirements: \"${{ env.requirements }}\"\n```\n\n\n#### Caching packages\n\nIt's also possible to cache the installed packages themselves, speeding up action running, by creating a `venv` first, activating it, and caching it between runs.\n\n```yaml\nenv:\n  version: \"==0.8.0\"\n  requirements: '[\"networkx==2.5\", \"pandas==1.0.5\"]'\njobs:\n  build_report:\n    runs-on: ubuntu-latest\n    name: Build Datapane report\n    steps:\n      - uses: actions/checkout@v2\n      - uses: actions/setup-python@v1\n        with:\n          python-version: 3.8\n      - uses: actions/cache@v2\n        with:\n          path: ~/.cache/pip\n          key: ${{ runner.os }}-pip-${{ env.requirements }}-${{ env.version }}\n      - uses: actions/cache@v2\n        with:\n          path: ~/.venv\n          key: ${{ runner.os }}-pip-${{ env.requirements }}-${{ env.version }}\n      - name: Create and activate venv\n        run: |\n          python3 -m venv ~/.venv\n          echo \"~/.venv/bin\" \u003e\u003e $GITHUB_PATH\n      - uses: datapane/build-action@v2\n        with:\n          script: \"reports/dp_script.py\"\n          token: ${{ secrets.TOKEN }}\n          requirements: \"${{ env.requirements }}\"\n```\n\nNote that when doing this, ensure that you clearly specify your package version in your requirements otherwise you may end up with cache hits for old versions of your packages.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatapane%2Fbuild-action","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdatapane%2Fbuild-action","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatapane%2Fbuild-action/lists"}