autobless #182
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: autobless | |
on: | |
schedule: | |
- cron: '44 4 * * *' # At 4:44 UTC every day. | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
build: | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
java-version: ['21'] | |
fail-fast: false | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: 'corretto' | |
java-version: ${{ matrix.java-version }} | |
- name: Build | |
run: cargo build --verbose | |
- name: Test crates, JNI 1.8 | |
run: cargo test --all-targets --verbose --features jni_1_8 | |
- name: Test crates, JNI 1.6 | |
run: cargo test --all-targets --verbose --features jni_1_6 | |
- name: setup bot git name and email | |
run: | | |
git config --global user.name 'The Duchess Cronjob Bot' | |
git config --global user.email '[email protected]' | |
- name: Push changes to a branch | |
run: | | |
BRANCH="bless-$(date -u +%Y-%m-%d)" | |
git switch -c $BRANCH | |
git push -u origin $BRANCH | |
- name: Create Pull Request | |
run: | | |
BRANCH="bless-$(date -u +%Y-%m-%d)" | |
MAIN_SHA=$(git rev-parse main) | |
BRANCH_SHA=$(git rev-parse $BRANCH) | |
# Check if the commit hashes are different | |
if [ "$MAIN_SHA" != "$BRANCH_SHA" ]; then | |
gh pr create -B main --title 'Automatic bless' --body '' | |
else | |
echo "No changes between main and $BRANCH, skipping pull request creation." | |
fi | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
DUCHESS_BLESS: 1 |