Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
50 changes: 0 additions & 50 deletions .github/ISSUE_TEMPLATE/1-bug.yml

This file was deleted.

33 changes: 0 additions & 33 deletions .github/ISSUE_TEMPLATE/2-feature.yml

This file was deleted.

37 changes: 0 additions & 37 deletions .github/ISSUE_TEMPLATE/3-other.yml

This file was deleted.

16 changes: 16 additions & 0 deletions .github/ISSUE_TEMPLATE/bug-issue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
name: Bug Report
about: Use this template to report a bug
title: ''
labels: kind/bug
assignees: ''

---

### Detailed description

A clear and concise description of what the problem is.

### Expected behaviour

Expected behaviour one the problem is fixed.
3 changes: 0 additions & 3 deletions .github/ISSUE_TEMPLATE/config.yml

This file was deleted.

14 changes: 14 additions & 0 deletions .github/ISSUE_TEMPLATE/feature-issue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
name: Feature request
about: Suggest an idea/feature for this project
title: ''
labels: 'kind/feature'
assignees: ''

---

### Motivation
Describe here the motivation of the request.

### Acceptance criteria
- [ ] A check list of tasks to be done to assume the issue addressed
6 changes: 0 additions & 6 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
<!--
SPDX-FileCopyrightText: 2025 INDUSTRIA DE DISEÑO TEXTIL S.A. (INDITEX S.A.)

SPDX-License-Identifier: Apache-2.0
-->

## Summary

Briefly describe the purpose of this PR and what changes it introduces.
Expand Down
167 changes: 167 additions & 0 deletions .github/workflows/code-PR_sync_to_develop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
---
name: code-PR-sync-to-develop

on:
pull_request:
types: [opened, closed]
branches: ['main', 'main-*']
paths-ignore: ['code/**']

jobs:
add-friendly-reminder:
name: Add Friendly Reminder Comment
if: github.head_ref != 'develop' && !startsWith(github.head_ref, 'develop-') && vars.DEVELOPMENT_FLOW != 'trunk-based-development'
timeout-minutes: 30
runs-on: ubuntu-24.04
outputs:
detected: ${{ steps.changes.outputs.paths }}
develop-branch: ${{ steps.sync-branch.outputs.DEVELOP_BRANCH }}
sync-branch: ${{ steps.sync-branch.outputs.SYNC_BRANCH }}
main-branch: ${{ steps.sync-branch.outputs.MAIN_BRANCH }}
steps:
- name: Check for changed files in specific paths
id: changes
uses: dorny/paths-filter@ebc4d7e9ebcb0b1eb21480bb8f43113e996ac77a

with:
filters: |
paths:
- 'code/**'

- name: Calculate SYNC, DEVELOP and MAIN branches
id: sync-branch
run: |
BASELINE_BRANCH=${{ github.base_ref }}
DEVELOP_BRANCH=${BASELINE_BRANCH/main/develop}
{
echo "DEVELOP_BRANCH=$DEVELOP_BRANCH"
echo "SYNC_BRANCH=automated/sync-from-$BASELINE_BRANCH-to-$DEVELOP_BRANCH"
echo "MAIN_BRANCH=$BASELINE_BRANCH"
} >> "$GITHUB_OUTPUT"

- name: Checkout
if: steps.changes.outputs.paths == 'false' && github.event.pull_request.merged == false
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Add PR comment - Friendly reminder
if: steps.changes.outputs.paths == 'false' && github.event.pull_request.merged == false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
sync_branch="${{ steps.sync-branch.outputs.SYNC_BRANCH }}"
develop_branch="${{ steps.sync-branch.outputs.DEVELOP_BRANCH }}"
if [[ -z $(git ls-remote --heads origin $sync_branch) ]]; then
body="
### :eyes: Friendly reminder
- When this **pull request has been merged, its commits will be synchronized** from an automated pull request (\`$sync_branch → $develop_branch\`).
"
else
pull_request=$(gh api "/repos/${{ github.repository }}/pulls" | jq -r ".[] | select(.head.ref==\"$sync_branch\") | .number")
if [[ -n $pull_request ]]; then
body="
### :eyes: Friendly reminder
- When this **pull request has been merged, its commits will be synchronized** from an existent automated pull request [\`$sync_branch → $develop_branch\`](https://github.com/${{ github.repository }}/pull/$pull_request), rebasing the branch with the new changes introduced.
"
else
body="
### :eyes: Friendly reminder
- When this **pull request has been merged, its commits will be synchronized** from an automated pull request (\`$sync_branch → $develop_branch\`) rebasing the previous existent branch with the new changes introduced.
"
fi
fi
gh pr comment ${{ github.event.number }} --body "$body"

sync-to-develop:
name: Code / Sync To Develop Branch
timeout-minutes: 30
needs: add-friendly-reminder
if: needs.add-friendly-reminder.outputs.detected == 'false' && github.event.pull_request.merged == true && vars.DEVELOPMENT_FLOW != 'trunk-based-development'
runs-on: ubuntu-24.04
concurrency:
group: ${{ github.workflow }}-${{ github.job }}
cancel-in-progress: true
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.base_ref }}

- name: Get existent branches and pull requests from repository
id: get-info
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
sync_branch="${{ needs.add-friendly-reminder.outputs.sync-branch }}"
if [[ -n $(git ls-remote --heads origin $sync_branch) ]]; then
pull_request=$(gh api "/repos/${{ github.repository }}/pulls" | jq -r ".[] | select(.head.ref==\"$sync_branch\") | .number")
echo "PULL_REQUEST=$pull_request" >> "$GITHUB_OUTPUT"
fi

- name: Commit changes
id: commit
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN_PUSH }}
run: |
develop="${{ needs.add-friendly-reminder.outputs.develop-branch }}"
if [[ -z $(git ls-remote --heads origin $develop) ]]; then
# Avoid creating sync PR if the corresponding development branch does not exist
echo "The $develop branch does not exist in remote. Skipping the creation of the sync PR"
else
sync_branch="${{ needs.add-friendly-reminder.outputs.sync-branch }}"
main_branch="${{ needs.add-friendly-reminder.outputs.main-branch }}"

if [[ -n $(git ls-remote --heads origin $sync_branch) ]]; then
git checkout "$sync_branch"
git rebase $main_branch
git push --no-verify -u origin HEAD
echo "EXIST_BRANCH=True" >> "$GITHUB_OUTPUT"
else
git checkout -b "$sync_branch"
git push --no-verify -u origin HEAD
echo "EXIST_BRANCH=False" >> "$GITHUB_OUTPUT"
fi
fi

- name: Create PR body
id: pr-body
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
pr_body="**Automated Pull Request** related to:"
pr_body="$pr_body"$'\n'"- #${{ github.event.pull_request.number }}"

delimiter="$(openssl rand -hex 8)"
echo "PR_BODY<<${delimiter}" >> "$GITHUB_OUTPUT"
echo "$pr_body" >> "$GITHUB_OUTPUT"
echo "${delimiter}" >> "${GITHUB_OUTPUT}"

- name: Create Automated PR
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN_PUSH }}
run: |
develop="${{ needs.add-friendly-reminder.outputs.develop-branch }}"
pull_request="${{ steps.get-info.outputs.PULL_REQUEST }}"
main_branch="${{ needs.add-friendly-reminder.outputs.main-branch }}"
pr_body="${{ steps.pr-body.outputs.PR_BODY }}"

if [[ $pull_request != "" ]]; then
gh pr edit $pull_request -b "$pr_body"
else
gh pr create --base "$develop" \
--title "Sync from $main_branch to $develop" \
--label 'kind/internal' \
--body "$pr_body"
fi

- name: Add PR comment - On Failure
if: ${{ failure() && !cancelled() }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr comment ${{ github.event.number }} --body "
### :exclamation: :exclamation: :exclamation: Sync to develop failure
- See the [workflow log](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}).
"
13 changes: 13 additions & 0 deletions .github/workflows/code-PR_verify-fallback.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
name: code-PR-verify-fallback

on:
pull_request:

jobs:
unit-tests:
if: 'false'
name: Code / Verify
runs-on: ubuntu-24.04
steps:
- run: 'echo "No Code / Verify required"'
Loading
Loading