Trigger report when pushing to 8.x #154
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: report | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 6 * * 1" | |
push: | |
branches: | |
- main | |
- 8.x | |
jobs: | |
generate_report: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
branch: | |
- 'main' | |
- '8.x' | |
- '8.17' | |
- '8.16' | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
ref: ${{ matrix.branch }} | |
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo | |
- uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 3.3 | |
env: | |
STACK_VERSION: 9.0.0-SNAPSHOT | |
- name: Build | |
run: | | |
cd report && bundle install | |
echo "REPORT_DATE=`date "+%Y-%m-%d|%H:%M:%S"`" >> $GITHUB_ENV | |
- name: Download Artifacts | |
run: cd report && bundle exec rake download_all | |
- name: Generate report | |
run: cd report && bundle exec rake report | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v6 | |
id: cpr | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
commit-message: Updates API report ${{env.REPORT_DATE}} ${{ matrix.branch }} | |
branch: update_report_${{ matrix.branch }} | |
title: Updates API report ${{ matrix.branch }} | |
body: 'As titled' | |
base: ${{ matrix.branch }} | |
committer: 'Elastic Machine <[email protected]>' | |
author: 'Elastic Machine <[email protected]>' | |
- name: Pull Request Summary | |
if: ${{ steps.cpr.outputs.pull-request-url }} | |
run: | | |
echo "${{ matrix.branch }} - ${{ steps.cpr.outputs.pull-request-url }}" >> $GITHUB_STEP_SUMMARY |