Skip to content

Commit

Permalink
Updated action
Browse files Browse the repository at this point in the history
  • Loading branch information
mmontes11 committed Jul 16, 2024
1 parent f59ef9c commit 74531ff
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ runs:
with:
fetch-depth: 0
repository: "${{ inputs.fork-repo-name }}"
path: "."
path: "fork-repo"
token: "${{ env.GITHUB_TOKEN }}"

- name: Configure Git
Expand All @@ -70,24 +70,32 @@ runs:
env:
GITHUB_TOKEN: "${{ env.GITHUB_TOKEN }}"
run: |
echo "🚀 Switching directory"
ROOT_DIR=$(pwd)
cd "fork-repo"
echo "🚀 Setting up upstream"
git remote add upstream "https://github.com/${{ inputs.upstream-repo-name }}"
git fetch --all
git reset --hard upstream/main
echo "🚀 Copying bundle"
CI_YAML="${ROOT_DIR}/${{ inputs.ci-path-file }}"
mkdir -p "operators/${{ inputs.name }}/${{ inputs.version }}"
rsync -av --exclude="ci.yaml" "${{ inputs.bundle-path-dir }}/" "operators/${{ inputs.name }}/${{ inputs.version }}"
rsync -av --exclude="${CI_YAML}" "${ROOT_DIR}/${{ inputs.bundle-path-dir }}/" "operators/${{ inputs.name }}/${{ inputs.version }}"
echo "🚀 Copying ci.yaml"
cp "${{ inputs.ci-path-file }}" "operators/${{ inputs.name }}/"
cp "${CI_YAML}" "operators/${{ inputs.name }}/"
echo "🚀 Submitting PR"
git add .
git commit -m "operator ${{ inputs.name }}(${{ inputs.version }})" --signoff
git push -f
PR_CMD="gh pr create --repo '${{ inputs.upstream-repo-name }}' --title 'operator ${{ inputs.name }} (${{ inputs.version }})' --body 'Added operator ${{ inputs.name }} (${{ inputs.version }})'"
if [ "${{ inputs.dry-run }}" == "true" ]; then
PR_CMD="$PR_CMD --dry-run"
PR_CMD="${PR_CMD} --dry-run"
fi
eval "$PR_CMD"
eval "${PR_CMD}"
echo "🚀 Switching back to root directory"
cd "${ROOT_DIR}"

0 comments on commit 74531ff

Please sign in to comment.