Initial version
18 files changed
tree: f8ce3093a8b97cb706ea0ccce1500936a1b7488c
  1. .github/
  2. __tests__/
  3. dist/
  4. src/
  5. .eslintignore
  6. .eslintrc.json
  7. .gitignore
  8. .pre-commit-config.yaml
  9. .prettierignore
  10. .prettierrc.json
  11. action.yml
  12. jest.config.js
  13. LICENSE
  14. package-lock.json
  15. package.json
  16. README.md
  17. tsconfig.json
  18. yamllint-config.yml
README.md

Get Workflow Runs action

Table of Contents generated with DocToc

Context and motivation

Get Workflow Origin is an action that provides missing information for workflow_run events Often in the workflow_run event you want to get more information about the source run than the one provided directly via GitHub context. For example you would like to know what is the merge commit generated by pull request in case the workflow was triggered by a pull request.

This action provides outputs that give the missing information. You should add this action as first one in the “workflow_run” event and then you will be able to use those outputs.

Inputs and outputs

Inputs

InputRequiredDefaultComment
tokenyesThe github token passed from ${{ secrets.GITHUB_TOKEN }}
sourceRunIdyesIt should be set to the id of the workflow triggering the run ${{ github.event.workflow_run.id }}

Outputs

OutputNo sourceRunId specifiedThe sourceRunId set to ${{ github.event.workflow_run.id }}
sourceHeadRepoCurrent repository. Format: owner/repoRepository of the run that triggered this workflow_run. Format: owner/repo
sourceHeadBranchCurrent branch.Branch of the run that triggered this workflow_run. Might be forked repo, if it is a pull_request.
sourceHeadShaCurrent commit SHA: {{ github.sha }}Commit sha of the run that triggered this workflow_run.
mergeCommitShaMerge commit SHA if PR-triggered event.Merge commit SHA if PR-triggered event.
targetCommitShaTarget commit SHA (merge if present, otherwise source).Target commit SHA (merge if present, otherwise source).
pullRequestNumberNumber of the associated Pull Request (if PR triggered)Number of the associated Pull Request (if PR triggered)
sourceEventCurrent event: ${{ github.event }}Event of the run that triggered this workflow_run

Development environment

It is highly recommended tu use pre commit. The pre-commits installed via pre-commit tool handle automatically linting (including automated fixes) as well as building and packaging Javascript index.js from the main.ts Typescript code, so you do not have to run it yourself.

License

MIT License covers the scripts and documentation in this project.