Skip to content

update github actions (#6) #68

update github actions (#6)

update github actions (#6) #68

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: Debug - List generated Kotlin files
run: |
files=$(find lib/build/generated/source/wire/ -type f -name '*.kt')
echo "Found files:"
echo "$files"
joined_files=$(echo "$files" | paste -sd ",")
echo "KOTLIN_FILES=$joined_files" >> $GITHUB_ENV
shell: bash
- name: Upload generated Kotlin files
id: upload-gen-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 Unix Timestamp
id: get-timestamp
run: echo "TIMESTAMP=$(date +'%s')" >> $GITHUB_ENV
- name: Create Branch
run: |
timestamp=$(date +'%s')
branch_name="branch-${timestamp}"
git checkout -b $branch_name
git push origin $branch_name
echo "BRANCH_NAME=$branch_name" >> $GITHUB_ENV
- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.TOKEN }}
branch: ${{ env.BRANCH_NAME }}
committer: Github Actions Bot <41898282+github-actions[bot]@users.noreply.github.com>
author: Github Actions Bot <41898282+github-actions[bot]@users.noreply.github.com>
commit-message: "Add generated Kotlin files ${{ env.TIMESTAMP }}"
title: "Add generated Kotlin files ${{ env.TIMESTAMP }}"
body: |
### Description
Automated PR to add generated Kotlin files from [Proto-API](https://github.com/ksharma-xyz/Proto-API)
### Config
Configuration of the workflow is located in `.github/workflows/gen-kotlin.yaml`.
base: main