Skip to content

Commit

Permalink
PR for Verify all modified component versions are incremented (Pipedr…
Browse files Browse the repository at this point in the history
…eamHQ#3527)

* PR for Verify all modified component versions are incremented

* Added some console logs

* Testing the fix with console logs

* Fixed when dependency was not even commited
  • Loading branch information
jcortes authored Aug 24, 2022
1 parent dc1df6c commit 3ea1ec3
Show file tree
Hide file tree
Showing 31 changed files with 1,091,357 additions and 41 deletions.
41 changes: 41 additions & 0 deletions .github/actions/git-diff-on-components/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Git diff on components action

This action takes care of all components with dependencies that were modified but the version was not incremented.

## Inputs

### `base_commit`

**Required** Base commit SHA.

### `head_commit`

**Required** Head commit SHA.

### `all_files`

**Required** List of all files comming from `changed_files` step in `check_version` job github action workflow. It is necessary to set the action `jitterbit/get-changed-files@v1` output in json format like
```
...
with:
format: json
```
in that way `steps.changed_files.outputs.all` will be converted in array of strings

## Example usage

```yaml
- name: Check git diff for version changes
uses: ./.github/actions/git-diff-on-components
with:
all_files: ${{ steps.changed_files.outputs.all }}
base_commit: ${{ github.event.pull_request.base.sha }}
head_commit: ${{ github.event.pull_request.head.sha }}
```
## Build
You need to push all files generated in `dist` folder once you are finished with the build to test the new version of the github action in case you want to make modifications.
```
$ cd .github/actions/git-diff-on-components/
$ npm i && npm run build
```
15 changes: 15 additions & 0 deletions .github/actions/git-diff-on-components/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: "Git diff on components"
description: "Check for version changes on components. Diff the changes in the HEAD ref (new branch) against the BASE ref (target branch, e.g. master). If the changes don't contain modifications to the version, we want to log that fact but not exit early. Once we've checked all files, exit the script if any files failed to modify version"
inputs:
base_commit:
description: "Base commit SHA"
required: true
head_commit:
description: "Head commit SHA"
required: true
all_files:
description: "List of all files comming from changed_files step in check_version job github action workflow"
required: true
runs:
using: "node16"
main: "dist/index.js"
Loading

0 comments on commit 3ea1ec3

Please sign in to comment.