Skip to content

Automatically update Gale commit hash #39

Automatically update Gale commit hash

Automatically update Gale commit hash #39

Workflow file for this run

name: Automatically update Gale commit hash
on:
workflow_dispatch:
schedule:
- cron: "0 0 * * *"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Leaf repository
uses: actions/checkout@main
with:
path: 'Leaf'
token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout Gale repository
uses: actions/checkout@main
with:
path: 'Gale'
repository: "Dreeam-qwq/Gale"
token: ${{ secrets.GITHUB_TOKEN }}
- name: Get Gale latest commit Hash
id: galeCommit
run: |
ls
cd Gale
echo "::set-output name=galeCommit::$(git rev-parse HEAD)"
cd ..
- name: Update galeCommit in Leaf
run: |
cd Leaf
sed -i "s/\(galeCommit\s*=\s*\).*/\1$PAPER_REF/" gradle.properties
env:
PAPER_REF: ${{ steps.galeCommit.outputs.galeCommit }}
- name: Grant execute permission for gradlew
run: |
git config --global user.name "github-actions"
git config --global user.email no-reply@github.com
cd Leaf
chmod +x gradlew
- name: Running tests before push
run: |
cd Leaf
if ! git diff --quiet; then
echo "Running tests...."
./gradlew applyPatches
./gradlew createReobfPaperclipJar
fi
- name: Check for changes and write to repository
run: |
cd Leaf
if ! git diff --quiet; then
echo "Writing to repo....."
git add .
git commit -m "Updated Upstream (Gale)"
git push
else
echo "No changes to commit."
fi