Update Repositories List #17
Workflow file for this run
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: Update Repositories List | |
on: | |
schedule: | |
- cron: '0 0 * * *' | |
workflow_dispatch: | |
jobs: | |
update-file: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install pyyaml requests | |
- name: Run update script | |
run: python scripts/update-repo-list.py | |
- name: Configure Git | |
run: | | |
git config --global user.name 'hmcts-platform-operations' | |
git config --global user.email '[email protected]' | |
- name: Create new branch | |
run: | | |
git checkout master | |
git pull origin master | |
git checkout -b update-repo-list | |
- name: Commit changes | |
run: | | |
git add production-repos.json | |
git commit -m 'Update repository list' | |
- name: Push changes to new branch | |
run: git push --set-upstream origin update-repo-list | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Install GitHub CLI | |
run: | | |
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key C99B11DEB97541F0 | |
sudo apt-add-repository https://cli.github.com/packages | |
sudo apt-get update | |
sudo apt-get install gh -y | |
- name: Authenticate GitHub CLI | |
run: echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token | |
- name: Create Pull Request | |
run: gh pr create --title "Automated Update Repository List" --body "This is an automated pull request to update the repository list." --head update-repo-list --base master |