leijerry888 is triggering GitHub Action in OSSTD #16
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
# majority adapt from https://dev.to/moaaz_adel/github-actions-a-simple-way-to-trigger-workflow-from-another-workflow-1b55 | |
name: Trigger OpenStudio Standards GitHub Action to Update Data | |
run-name: ${{github.actor}} is triggering GitHub Action in OSSTD | |
on: [push] # TODO: to be modified later with PR merge | |
jobs: | |
trigger-osstd-update: | |
name: Trigger OpenStudio GitHub Action to initiate a PR there with data update pulling data from here. | |
runs-on: 'ubuntu-latest' | |
steps: | |
- name: Update Data | |
run: | | |
git clone https://github.com/pnnl/building-energy-standards-data.git | |
cd building-energy-standards-data | |
git checkout cross_repo_actions | |
cd osstd_data_update | |
export COMMIT_ID=${{ github.sha }} | |
export GHTOKEN=${{ secrets.JERRY_ACTIONS_KEY }} | |
./run.sh | |
# TODO: remove git checkout cross_repo_actions before merge to develop | |
- name: GitHub API to trigger PR | |
run: | | |
curl -L \ | |
-X POST \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "Authorization: Bearer ${{ secrets.JERRY_ACTIONS_KEY }}" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
https://api.github.com/repos/pnnl/building-energy-standards-data/pulls \ | |
-d '{"title":"Pull Data from building-energy-standards-data repo","body":"Automated PR created by Github Action from the BES Data repository (with Commit ID: ${{ github.sha }}), to update OSSTD data. Human review is needed.","head":"data_update","base":"develop"}' |