|
| 1 | +# Generated for Konflux Application openshift-pipelines-core-1.16 by openshift-pipelines/hack. DO NOT EDIT |
| 2 | +name: update-sources-release-v0.16.x |
| 3 | + |
| 4 | +on: |
| 5 | + workflow_dispatch: {} |
| 6 | + schedule: |
| 7 | + - cron: "0 1 * * *" # At 1AM everyday |
| 8 | + |
| 9 | +jobs: |
| 10 | + |
| 11 | + update-sources: |
| 12 | + runs-on: ubuntu-latest |
| 13 | + if: github.repository_owner == 'openshift-pipelines' # do not run this elsewhere |
| 14 | + permissions: |
| 15 | + contents: write |
| 16 | + pull-requests: write |
| 17 | + steps: |
| 18 | + - name: Checkout the current repo |
| 19 | + uses: actions/checkout@v4 |
| 20 | + with: |
| 21 | + ref: release-v0.16.x |
| 22 | + |
| 23 | + - name: Clone tektoncd/results |
| 24 | + run: | |
| 25 | + rm -fR upstream |
| 26 | + git clone https://github.com/tektoncd/results upstream |
| 27 | + pushd upstream |
| 28 | + git checkout -B release-v0.12.x origin/release-v0.12.x |
| 29 | + popd |
| 30 | +
|
| 31 | +
|
| 32 | + - name: Commit new changes |
| 33 | + run: | |
| 34 | + git config user.name openshift-pipelines-bot |
| 35 | + git config user.email [email protected] |
| 36 | + git checkout -b actions/update/sources-release-v0.16.x |
| 37 | + touch head |
| 38 | + pushd upstream |
| 39 | + OLD_COMMIT=$(cat ../head) |
| 40 | + NEW_COMMIT=$(git rev-parse HEAD) |
| 41 | + echo Previous commit: ${OLD_COMMIT} |
| 42 | + git show --stat ${OLD_COMMIT} |
| 43 | + echo New commit: ${NEW_COMMIT} |
| 44 | + git show --stat ${NEW_COMMIT} |
| 45 | + git diff --stat ${NEW_COMMIT}..${OLD_COMMIT} > /tmp/diff.txt |
| 46 | + git rev-parse HEAD > ../head |
| 47 | + popd |
| 48 | + rm -rf upstream/.git |
| 49 | + git add -f upstream head .konflux |
| 50 | +
|
| 51 | + if [[ -z $(git status --porcelain --untracked-files=no) ]]; then |
| 52 | + echo "No change, exiting" |
| 53 | + exit 0 |
| 54 | + fi |
| 55 | +
|
| 56 | + git commit -F- <<EOF |
| 57 | + [bot] Update release-v0.16.x from tektoncd/results to ${NEW_COMMIT} |
| 58 | +
|
| 59 | + $ git diff --stat ${NEW_COMMIT}..${OLD_COMMIT} |
| 60 | + $(cat /tmp/diff.txt | sed 's/^/ /' | head -c 55555) |
| 61 | + |
| 62 | + https://github.com/tektoncd/results/compare/${NEW_COMMIT}..${OLD_COMMIT} |
| 63 | + EOF |
| 64 | + |
| 65 | + git push -f origin actions/update/sources-release-v0.16.x |
| 66 | +
|
| 67 | + if [ "$(gh pr list --base release-v0.16.x --head actions/update/sources-release-v0.16.x --json url --jq 'length')" = "0" ]; then |
| 68 | + echo "creating PR..." |
| 69 | + gh pr create -B release-v0.16.x -H actions/update/sources-release-v0.16.x --label=automated --label=upstream --fill |
| 70 | + else |
| 71 | + echo "a PR already exists, editing..." |
| 72 | + gh pr edit --title "[bot] Update release-v0.16.x from tektoncd/results to ${NEW_COMMIT}" --body "$(cat /tmp/diff.txt | sed 's/^/ /' | head -c 55555)" |
| 73 | + fi |
| 74 | + env: |
| 75 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments