Skip to content

Github Actions - Export Kotlin Files #48

Github Actions - Export Kotlin Files

Github Actions - Export Kotlin Files #48

Workflow file for this run

name: Generate Kotlin
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:
jobs:
generate-kotlin:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: List directory structure before building
run: ls -R
- name: Generate Protos
run: ./gradlew generateProtos
- name: List directory structure after building
run: ls -R
- name: List generated Kotlin files for debugging
run: |
find lib/build/generated/source/wire/ -type f -name "*.kt" || echo "Directory not found"
- name: List generated Kotlin files
run: |
gen_files=$(find lib/build/generated/source/wire/ -type f -name "*.kt" | tr '\n' ', ')
if [ -z "$gen_files" ]; then
echo "Directory not found or no files found"
else
echo 'gen_files_list<<$gen_files'
fi
- name: Upload generated Kotlin files
uses: actions/upload-artifact@v4
with:
name: generated-kotlin-files
path: lib/build/generated/source/wire/**/*.kt
- name: Checkout target repo
uses: actions/checkout@v4
with:
repository: 'ksharma-xyz/Kotlin-Proto'
token: ${{ secrets.TOKEN }}
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: generated-kotlin-files
path: ./generated
- name: Get Timestamp
run: echo ::set-output name=TIMESTAMP::$(date +'%Y-%m-%dT%H:%M:%S')
- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.TOKEN }}
branch-suffix: timestamp
committer: Github Actions Bot <42103905+github-actions[bot]@users.noreply.github.com>
author: Github Actions Bot <42103905+github-actions[bot]@users.noreply.github.com>
commit-message: "Add generated Kotlin files ${{ steps.get-timestamp.outputs.TIMESTAMP }}"
title: "Add generated Kotlin files ${{ steps.get-timestamp.outputs.TIMESTAMP }}"
body: |
## Description
Automated PR to add generated Kotlin files from [Proto-API](https://github.com/ksharma-xyz/Proto-API)
### List of files added:
${{ steps.generate-kotlin.outputs.gen_files_list }}
## Config
Configuration of the workflow is located in `.github/workflows/gen-kotlin.yaml`.
base: main