Skip to content

Commit

Permalink
pre-prod actions migration
Browse files Browse the repository at this point in the history
  • Loading branch information
yceballost committed Jan 11, 2024
1 parent b319f28 commit 19315a8
Show file tree
Hide file tree
Showing 8 changed files with 224 additions and 11 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/changelog-index.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,27 @@ on:
workflow_dispatch:
push:
branches:
- pre-production
- production
paths:
- ".github/resources/changelog-index-generator.py"
- "changelog-versions/**"

jobs:
create-release-notes:
changelog-index:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions/checkout@v3
with:
token: ${{ secrets.NOVUM_PRIVATE_REPOS }}

- name: Get branch name
uses: rlespinasse/github-slug-action@v3.x

- run: sudo python3 .github/resources/changelog-index-generator.py changelog-versions
- run: |
sudo pip3 install GitPython
sudo python3 .github/resources/changelog-index-generator.py changelog-versions
cat CHANGELOG.md
- name: Commit & Push in ${{ env.GITHUB_REF_SLUG_URL }}
run: |
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ on:
default: "1.0.0"

jobs:
create-release-notes:
release-notes:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions/checkout@v3
with:
token: ${{ secrets.NOVUM_PRIVATE_REPOS }}

Expand All @@ -29,7 +29,7 @@ jobs:
- name: Create Release Notes
uses: docker://decathlon/release-notes-generator-action:3.1.5
env:
GITHUB_TOKEN: ${{ secrets.PERSONAL_TOKEN }}
GITHUB_TOKEN: ${{ secrets.NOVUM_PRIVATE_REPOS }}
OUTPUT_FOLDER: changelog-versions
USE_MILESTONE_TITLE: "true"
FILENAME_PREFIX: ${{ github.event.inputs.releaseVersion }}
Expand All @@ -49,7 +49,7 @@ jobs:
# env:
# ACTION_MAIL: myuser@users.noreply.github.com
# ACTION_NAME: místicaBot
# GH_PAT: ${{ secrets.PERSONAL_TOKEN }}
# GH_PAT: ${{ secrets.NOVUM_PRIVATE_REPOS_READONLY }}
# MD_FOLDER: changelog-versions
# OWNER: Telefonica
# REPO_NAME: mistica-design
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dashboard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
# types: [opened, closed, reopened]

jobs:
build:
build-dashboard:
runs-on: ubuntu-latest

steps:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/link-checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
workflow_dispatch:

jobs:
linkChecker:
link-checker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -13,4 +13,4 @@ jobs:
id: lychee
uses: lycheeverse/lychee-action@v1.5.1
env:
GITHUB_TOKEN: ${{secrets.PERSONAL_TOKEN}}
GITHUB_TOKEN: ${{secrets.NOVUM_PRIVATE_REPOS_READONLY}}
44 changes: 44 additions & 0 deletions .github/workflows/mistica-ai.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Mística AI Discussions

permissions:
contents: read
pull-requests: write

on:
discussion:
types: [created, edited]

concurrency:
group: ${{ github.repository }}-${{ github.event.number || github.head_ref || github.sha }}-${{ github.workflow }}
cancel-in-progress: true

jobs:
chatgpt:
runs-on: ubuntu-latest
steps:
- uses: platisd/openai-pr-description@master
with:
github_token: ${{ secrets.NOVUM_PRIVATE_REPOS }}
openai_api_key: ${{ secrets.OPENAI_API_KEY }}
sample_prompt: |
It acts as the person who will decide whether a design requirement should enter into an overall design system and complies with the following rules:
1. The requirement must be global, i.e. it must work outside the product and/or business logic. It should be as agnostic as possible.
2. It must be scalable to another type of product.
3. It should work for mobile and desktop environments
4. That it is multi-brand
sample_response: |
Base on rules that Mística defines, evaluate the proposal with the following requirements:
1. The requirement must be global, i.e. it must work outside the product and/or business logic. It should be as agnostic as possible.
2. It must be scalable to another type of product.
3. It should work for mobile and desktop environments
4. That it is multi-brand
- name: Add comment to discussion
run: |
curl -X POST \
-H "Authorization: Bearer ${{ secrets.NOVUM_PRIVATE_REPOS }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/{owner}/{repo}/discussions/{discussion_number}/comments \
--data-raw '{"body": "Generated response: ${description}"}'
env:
description: ${{ steps.openai-pr-description.outputs.response }}
73 changes: 73 additions & 0 deletions .github/workflows/pending-tasks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Pending tasks in issues

on:
workflow_dispatch:

jobs:
pending-tasks:
runs-on: ubuntu-latest
steps:
- name: Checkout del repositorio
uses: actions/checkout@v2

- name: Configurar Python
uses: actions/setup-python@v2
with:
python-version: 3.x # Especifica la versión de Python que necesites

- name: Instalar dependencias
run: |
python -m pip install --upgrade pip
pip install PyGithub
- name: Ejecutar script de búsqueda
env:
TOKEN: ${{ secrets.NOVUM_PRIVATE_REPOS }}
run: |
python - <<EOF
import os
from github import Github
TOKEN = os.environ['TOKEN']
# Nombre de usuario y nombre del repositorio
OWNER = 'Telefonica'
REPO = 'mistica-design'
# URL base del repositorio
REPO_URL = f'https://github.com/{OWNER}/{REPO}'
# Crea una instancia de la clase Github usando tu token de acceso
g = Github(TOKEN)
# Obtiene el repositorio
repo = g.get_repo(f'{OWNER}/{REPO}')
# Busca las issues cerradas en el repositorio
closed_issues = repo.get_issues(state='closed')
# Lista para almacenar las issues con checkboxes desactivados
issues_con_checkboxes_desactivados = []
# Itera sobre las issues cerradas
for issue in closed_issues:
# Verifica que el cuerpo de la issue no sea None
if issue.body is not None and '- [ ]' in issue.body:
issues_con_checkboxes_desactivados.append(issue)
continue
# Obtiene los comentarios de la issue
comments = issue.get_comments()
# Busca checkboxes desactivados en los comentarios
for comment in comments:
if '- [ ]' in comment.body:
issues_con_checkboxes_desactivados.append(issue)
break
# Imprime el listado de issues con checkboxes desactivados
print("Issues con checkboxes desactivados:")
for issue in issues_con_checkboxes_desactivados:
issue_url = f'{REPO_URL}/issues/{issue.number}'
print(f"Issue #{issue.number}: {issue.title} ({issue_url})")
EOF
92 changes: 92 additions & 0 deletions .github/workflows/screenshot-testing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: Screenshot test

# push:
# paths:
# - ".github/workflows/figma-export.yml"

on:
workflow_dispatch:
inputs:
branchID:
description: "Put Figma BranchID to generate screenshot testing"
required: true

env:
FIGMA_TOKEN: ${{ secrets.FIGMA_TOKEN}}

jobs:
screenshot-test:
name: Acceptance tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Checkout branch or create new one
run: |
git fetch
if git branch -a | grep origin/acceptance-tests; then
git checkout acceptance-tests
else
git checkout -b acceptance-tests
fi
- name: Instalar Homebrew
run: |
sudo apt-get install -y librsvg2-bin
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- name: Update master to last version
run: npx -p @figma-export/cli -p @figma-export/output-components-as-svg figma-export components WCkDDzlXE16R6yXaljxddj -O @figma-export/output-components-as-svg

- name: convert-svg2png
run: |
find output -type f -name "*.svg" -exec rsvg-convert --dpi-x=200 --dpi-y=200 {} -o {}.png \;
find output -type f -name "*.svg" -exec rm -f {} \;
- name: Check if there are any changes
id: verify_diff
run: |
git diff --quiet . || echo "changed=true" >> $GITHUB_OUTPUT
- name: Commit & Push
if: steps.verify_diff.outputs.changed == 'true'
run: |
git config user.name "github-actions"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add .
git commit -m "Screenshot tests from master"
git push origin acceptance-tests
- name: Checkout branch or create new one
run: |
git fetch
if git branch -a | grep origin/${{ github.event.inputs.branchID }}; then
git checkout ${{ github.event.inputs.branchID }}
else
git checkout -b ${{ github.event.inputs.branchID }}
fi
- name: Export new screenshots
run: npx -p @figma-export/cli -p @figma-export/output-components-as-svg figma-export components ${{ github.event.inputs.branchID }} -O @figma-export/output-components-as-svg

- name: convert-svg2png
run: |
find output -type f -name "*.svg" -exec rsvg-convert --dpi-x=200 --dpi-y=200 {} -o {}.png \;
find output -type f -name "*.svg" -exec rm -f {} \;
- name: Commit & Push
run: |
git config user.name "github-actions"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add .
git commit -m "Screenshot tests from ${{ github.event.inputs.branchID }}"
git push origin ${{ github.event.inputs.branchID }}
- name: Create Pull-Request
uses: repo-sync/pull-request@v2
with:
source_branch: ${{ github.event.inputs.branchID }}
destination_branch: "acceptance-tests"
pr_title: "Acceptance tests for ${{ github.event.inputs.branchID }} file"
pr_draft: true
github_token: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/tokens-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
- "tokens/*"

jobs:
update-description:
tokens-preview:
runs-on: ubuntu-latest
steps:
- name: Get branch name
Expand Down

0 comments on commit 19315a8

Please sign in to comment.