Skip to content

Refresh openEuler repo #761

Refresh openEuler repo

Refresh openEuler repo #761

name: Refresh openEuler repo
on:
schedule:
- cron: '0 0 * * 1-5'
issue_comment:
types: [created]
jobs:
openstack_release_refresh:
name: Refresh openEuler repo
if: ${{ contains(github.event.comment.body, 'recheck_repo') || github.event_name == 'schedule' }}
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Install python3
uses: actions/setup-python@v2
- name: Install requirement
run: |
sudo apt install python3-pip git
- name: Prepare oos and run the script
run: |
set -ex
# clone openstack
git clone https://gitee.com/openstack-sig-bot/openstack
# update config and code
pushd openstack
git config user.name "openstack-sig-bot"
git config user.email "wxy2933@163.com"
git remote set-url origin https://openstack-sig-bot:${{ secrets.gitee_password }}@gitee.com/openstack-sig-bot/openstack.git
git remote add upstream https://gitee.com/openeuler/openstack
git remote update
git merge upstream/master
git push origin master -u
popd
# Install oos and run script
pushd openstack/tools/oos
pip install -r requirements.txt
pip install -e .
popd
pushd openstack/tools/oos/scripts
git clone https://gitee.com/openeuler/community community
python3 ./fetch_openeuler_repo_name.py --path /home/runner/work/openeuler_openstack_action/openeuler_openstack_action/openstack/tools/oos/scripts/community
mv openeuler_repo.yaml ../etc/
python3 ./fetch_openeuler_repo_name.py --path /home/runner/work/openeuler_openstack_action/openeuler_openstack_action/openstack/tools/oos/scripts/community --sig sig-openstack
mv openeuler_repo.yaml ../etc/openeuler_sig_repo.yaml
rm -rf community
result=`git diff`
if [ -n "$result" ];then
# push the change
git checkout -b daily_update_src_openeuler_repo
git add .
git commit -a -m "Daily update - openEuler repo"
git push origin HEAD -u
# create pull request
curl -X POST --header 'Content-Type: application/json;charset=UTF-8' 'https://gitee.com/api/v5/repos/openeuler/openstack/pulls' -d '{"access_token":"${{ secrets.gitee_bot_token }}","title":"Daily update - openEuler repo","head":"openstack-sig-bot:daily_update_src_openeuler_repo","base":"master","prune_source_branch":"true"}'
fi