Skip to content

Commit

Permalink
Refactored Update-Dependencies workflow using composite action [skip …
Browse files Browse the repository at this point in the history
…ci] (#208) 09/29/2023 | 23w39b1
  • Loading branch information
GamesTrap committed Oct 1, 2023
1 parent 200501c commit f6917a1
Show file tree
Hide file tree
Showing 2 changed files with 211 additions and 568 deletions.
62 changes: 62 additions & 0 deletions .github/composite/update-git-dependency/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: "Update Git Dependency"
author: Jan Schürkamp <[email protected]>
description: ""
inputs:
dependency-path:
description: ""
required: true
branch:
description: ""
required: false
default: "main"
tag-regex:
description: ""
required: false
default: ""
update-method:
description: ""
required: true
default: "latest-commit"
pr-title:
description: ""
required: true
pr-branch-name:
description: ""
required: true
pr-token:
description: 'GITHUB_TOKEN or a `repo` scoped Personal Access Token (PAT)'
required: true
runs:
using: "composite"
steps:
- name: Update Dependency
shell: bash
id: dependency
run: |
homePath=$(pwd)
cd ${{inputs.dependency-path}}
if [[ ${{inputs.update-method}} == "latest-commit" ]]; then
git checkout ${{inputs.branch}}
git pull origin ${{inputs.branch}}
echo "DEPENDENCY_VERSION=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
elif [[ ${{inputs.update-method}} == "latest-tag" ]]; then
git fetch --tags
git checkout $(git tag --sort=-v:refname | grep -E ${{inputs.tag-regex}} | head -n 1)
echo "DEPENDENCY_VERSION=$(git tag --sort=-v:refname | grep -E ${{inputs.tag-regex}} | head -n 1)" >> "$GITHUB_OUTPUT"
fi
cd $homePath
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
base: dev
add-paths: ${{inputs.dependency-path}}
branch: ${{inputs.pr-branch-name}}/${{steps.dependency.outputs.DEPENDENCY_VERSION}}
delete-branch: true
commit-message: "Update ${{inputs.pr-title}} to ${{steps.dependency.outputs.DEPENDENCY_VERSION}}"
title: "Update ${{inputs.pr-title}} to ${{steps.dependency.outputs.DEPENDENCY_VERSION}}"
labels: "CI/CD, External, Update"
assignees: "GamesTrap"
milestone: 5
token: ${{inputs.pr-token}}
author: "TRAP CI/CD <[email protected]>"
committer: "TRAP CI/CD <[email protected]>"
Loading

0 comments on commit f6917a1

Please sign in to comment.