diff --git a/.github/workflows/auto-merge-upstream-release-v1.19.x.yaml b/.github/workflows/auto-merge-upstream-release-v1.19.x.yaml new file mode 100644 index 0000000000..b7c2d289d7 --- /dev/null +++ b/.github/workflows/auto-merge-upstream-release-v1.19.x.yaml @@ -0,0 +1,29 @@ +# Generated for Konflux Application openshift-pipelines-core by openshift-pipelines/hack. DO NOT EDIT +name: auto-merge-upstream-release-v1.19.x + +on: + workflow_dispatch: {} + schedule: + - cron: "*/30 * * * *" # At every 30 minutes + +jobs: + auto-approve: + runs-on: ubuntu-latest + if: github.repository_owner == 'openshift-pipelines' # do not run this elsewhere + permissions: + pull-requests: write + steps: + - name: Checkout the current repo + uses: actions/checkout@v4 + - name: auto-merge-upstream-release-v1.19.x + run: | + gh auth status + git config user.name openshift-pipelines-bot + git config user.email pipelines-extcomm@redhat.com + # Approve and merge pull-request with no reviews + for p in $(gh pr list --search "head:actions/update/sources-release-v1.19.x" --json "number" | jq ".[].number"); do + gh pr merge --rebase --delete-branch --auto $p + done + env: + GH_TOKEN: ${{ secrets.OPENSHIFT_PIPELINES_ROBOT }} + diff --git a/.github/workflows/auto-merge-upstream.yaml b/.github/workflows/auto-merge-upstream.yaml deleted file mode 100644 index 4a0d62f914..0000000000 --- a/.github/workflows/auto-merge-upstream.yaml +++ /dev/null @@ -1,45 +0,0 @@ -# Generated for Konflux Application openshift-pipelines-core by openshift-pipelines/hack. DO NOT EDIT -name: auto-merge-upstream -on: - workflow_dispatch: {} - schedule: - - cron: "0,30 * * * *" -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - collect-branches: - runs-on: ubuntu-latest - outputs: - matrix: ${{ steps.set-matrix.outputs.matrix }} - steps: - - name: Get branches matching pattern - id: set-matrix - run: | - # List all branches and filter - branches=$(gh api repos/${{ github.repository }}/branches --paginate -q '.[] | .name' | grep -E '^(release-v.*\.x$|next$)') - echo "Found branches:" - echo "$branches" - # Convert to JSON array for matrix - json=$(jq -nc --argjson arr "$(printf '%s\n' "$branches" | jq -R . | jq -s .)" '{branch: $arr}') - echo "Matrix JSON: $json" - echo "matrix=$json" >> $GITHUB_OUTPUT - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - auto-merge-upstream-all: - needs: collect-branches - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: ${{ fromJSON(needs.collect-branches.outputs.matrix) }} - steps: - - name: Trigger auto-merge-upstream for ${{ matrix.branch }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - echo Triggering workflow for branch: ${{ matrix.branch }} - - gh workflow run "auto-merge-upstream.yaml" \ - --ref ${{ matrix.branch }} \ - --repo ${{ github.repository }} diff --git a/.github/workflows/update-sources-release-v1.19.x.yaml b/.github/workflows/update-sources-release-v1.19.x.yaml new file mode 100644 index 0000000000..372d007741 --- /dev/null +++ b/.github/workflows/update-sources-release-v1.19.x.yaml @@ -0,0 +1,73 @@ +# Generated for Konflux Application openshift-pipelines-core by openshift-pipelines/hack. DO NOT EDIT +name: update-sources-release-v1.19.x + +on: + workflow_dispatch: {} + schedule: + - cron: "0 1 * * *" # At 1AM everyday + +jobs: + + update-sources: + runs-on: ubuntu-latest + if: github.repository_owner == 'openshift-pipelines' # do not run this elsewhere + permissions: + contents: write + pull-requests: write + steps: + - name: Checkout the current repo + uses: actions/checkout@v4 + with: + ref: release-v1.19.x + + - name: Clone tektoncd/chains + run: | + rm -fR upstream + git clone https://github.com/tektoncd/chains upstream + pushd upstream + git checkout -B release-v0.25.x origin/release-v0.25.x + popd + - name: Commit new changes + run: | + git config user.name openshift-pipelines-bot + git config user.email pipelines-extcomm@redhat.com + git checkout -b actions/update/sources-release-v1.19.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- <> $GITHUB_OUTPUT - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - build: - needs: collect-branches - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: ${{ fromJSON(needs.collect-branches.outputs.matrix) }} - steps: - - name: Trigger update-sources workflow for ${{ matrix.branch }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - echo Triggering workflow for branch: ${{ matrix.branch }} - - gh workflow run "update-sources.yaml" \ - --ref ${{ matrix.branch }} \ - --repo ${{ github.repository }}