update-sources #132
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Generated for Konflux Application openshift-pipelines-core by openshift-pipelines/hack. DO NOT EDIT | |
| name: update-sources | |
| on: | |
| workflow_dispatch: {} | |
| jobs: | |
| update-sources: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| steps: | |
| - name: Checkout the current repo | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: release-v1.22.x | |
| - name: Clone tektoncd-catalog/git-clone | |
| run: | | |
| rm -fR upstream | |
| git clone https://github.com/tektoncd-catalog/git-clone upstream | |
| pushd upstream | |
| git checkout -B release-v1.2.x origin/release-v1.2.x | |
| popd | |
| - name: Commit new changes | |
| run: | | |
| set -x | |
| git config user.name openshift-pipelines-bot | |
| git config user.email [email protected] | |
| git checkout -b actions/update/sources-release-v1.22.x | |
| touch head | |
| pushd upstream | |
| OLD_COMMIT=$(cat ../head) | |
| NEW_COMMIT=$(git rev-parse HEAD) | |
| echo Previous commit: ${OLD_COMMIT} | |
| git show --stat ${OLD_COMMIT} | |
| echo New commit: ${NEW_COMMIT} | |
| git show --stat ${NEW_COMMIT} | |
| git diff --stat ${NEW_COMMIT}..${OLD_COMMIT} > /tmp/diff.txt | |
| git rev-parse HEAD > ../head | |
| popd | |
| rm -rf upstream/.git | |
| git add -f upstream head .konflux | |
| if [[ -z $(git status --porcelain --untracked-files=no) ]]; then | |
| echo "No change, exiting" | |
| exit 0 | |
| fi | |
| git commit -F- <<EOF | |
| [bot] Update release-v1.22.x from tektoncd-catalog/git-clone to ${NEW_COMMIT} | |
| $ git diff --stat ${NEW_COMMIT}..${OLD_COMMIT} | |
| $(cat /tmp/diff.txt | sed 's/^/ /' | head -c 55555) | |
| https://github.com/tektoncd-catalog/git-clone/compare/${NEW_COMMIT}..${OLD_COMMIT} | |
| EOF | |
| git push -f origin actions/update/sources-release-v1.22.x | |
| if [ "$(gh pr list --base release-v1.22.x --head actions/update/sources-release-v1.22.x --json url --jq 'length')" = "0" ]; then | |
| echo "creating PR..." | |
| gh pr create -B release-v1.22.x -H actions/update/sources-release-v1.22.x --label=automated --label=upstream --fill | |
| else | |
| echo "a PR already exists, editing..." | |
| gh pr edit --title "[bot] Update release-v1.22.x from tektoncd-catalog/git-clone to ${NEW_COMMIT}" --body "$(cat /tmp/diff.txt | sed 's/^/ /' | head -c 55555)" | |
| fi | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |