Skip to content

Commit b7cd190

Browse files
openshift-pipelines-botpramodbindal
authored andcommitted
[bot:main] update konflux configuration
1 parent 82cc398 commit b7cd190

File tree

1 file changed

+74
-0
lines changed

1 file changed

+74
-0
lines changed
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Generated by openshift-pipelines/hack. DO NOT EDIT.
2+
name: update-sources-release-v1.17.x
3+
4+
on:
5+
workflow_dispatch: {}
6+
schedule:
7+
- cron: "0 1 * * 1" # At 1AM every monday
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-v1.17.x
22+
23+
- name: Clone tektoncd-catalog/git-clone
24+
run: |
25+
rm -fR upstream
26+
git clone https://github.com/tektoncd-catalog/git-clone upstream
27+
pushd upstream
28+
git checkout -B main origin/main
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-v1.17.x
37+
pushd upstream
38+
OLD_COMMIT=$(cat ../head)
39+
NEW_COMMIT=$(git rev-parse HEAD)
40+
echo Previous commit: ${OLD_COMMIT}
41+
git show --stat ${OLD_COMMIT}
42+
echo New commit: ${NEW_COMMIT}
43+
git show --stat ${NEW_COMMIT}
44+
git diff --stat ${NEW_COMMIT}..${OLD_COMMIT} > /tmp/diff.txt
45+
git rev-parse HEAD > ../head
46+
popd
47+
rm -rf upstream/.git
48+
git add -f upstream head .konflux
49+
50+
if [[ -z $(git status --porcelain --untracked-files=no) ]]; then
51+
echo "No change, exiting"
52+
exit 0
53+
fi
54+
55+
git commit -F- <<EOF
56+
[bot] Update release-v1.17.x from tektoncd-catalog/git-clone to ${NEW_COMMIT}
57+
58+
$ git diff --stat ${NEW_COMMIT}..${OLD_COMMIT}
59+
$(cat /tmp/diff.txt | sed 's/^/ /' | head -c 55555)
60+
61+
https://github.com/tektoncd-catalog/git-clone/compare/${NEW_COMMIT}..${OLD_COMMIT}
62+
EOF
63+
64+
git push -f origin actions/update/sources-release-v1.17.x
65+
66+
if [ "$(gh pr list --base release-v1.17.x --head actions/update/sources-release-v1.17.x --json url --jq 'length')" = "0" ]; then
67+
echo "creating PR..."
68+
gh pr create -B release-v1.17.x -H actions/update/sources-release-v1.17.x --label=automated --label=upstream --fill
69+
else
70+
echo "a PR already exists, editing..."
71+
gh pr edit --title "[bot] Update release-v1.17.x from tektoncd-catalog/git-clone to ${NEW_COMMIT}" --body "$(cat /tmp/diff.txt | sed 's/^/ /' | head -c 55555)"
72+
fi
73+
env:
74+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)