Update repos #79
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 repos | |
on: | |
workflow_dispatch: | |
inputs: | |
repos: | |
type: string | |
default: __all_cookiecuttered_repos__ | |
description: "Enter a space-separated list of repos to update. For example: 'hypothesis/repo-1 hypothesis/repo-2 hypothesis/repo-3'. By default it will search for and update all cookiecuttered repos in the Hypothesis GitHub organization." | |
schedule: | |
- cron: '0 0 1 * *' | |
jobs: | |
update_repos: | |
name: Update repos | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install Python 3.10 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- name: Install pipx | |
run: python3.10 -m pip install pipx | |
- name: Install tox | |
run: python3.10 -m pipx install "tox<4" | |
- name: Install gh-pr-upsert | |
run: python3.10 -m pipx install "git+https://github.com/hypothesis/gh-pr-upsert.git" | |
- name: Install Commando | |
run: python3.10 -m pipx install "git+https://github.com/hypothesis/commando.git" | |
- name: Install gha-token | |
run: python3.10 -m pipx install "git+https://github.com/hypothesis/gha-token.git" | |
- name: Configure git | |
run: | | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
- name: Get GitHub token | |
id: github_token | |
run: echo GITHUB_TOKEN=$(gha-token --app-id 274948 --installation-id 32440510 --private-key "$PRIVATE_KEY") >> $GITHUB_OUTPUT | |
env: | |
PRIVATE_KEY: ${{ secrets.HYPOTHESIS_GITHUB_APP_PRIVATE_KEY }} | |
- name: Set up git authentication | |
run: gh auth setup-git | |
env: | |
GITHUB_TOKEN: ${{ steps.github_token.outputs.GITHUB_TOKEN }} | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Find repos | |
id: find_repos | |
run: | | |
if [ "${{ inputs.repos || '__all_cookiecuttered_repos__' }}" = "__all_cookiecuttered_repos__" ] | |
then | |
echo "REPOS=$(bin/find_repos | xargs)" >> $GITHUB_OUTPUT | |
else | |
echo "REPOS=${{ inputs.repos }}" >> $GITHUB_OUTPUT | |
fi | |
env: | |
GITHUB_TOKEN: ${{ steps.github_token.outputs.GITHUB_TOKEN }} | |
- name: Update repos | |
run: commando --repos ${{ steps.find_repos.outputs.repos }} --branch cookiecutter --command "tox -e template" --commit-message-file commit_message.txt --pr-title "Apply updates from cookiecutter" --pr-body-file pr_body.md | |
env: | |
GITHUB_TOKEN: ${{ steps.github_token.outputs.GITHUB_TOKEN }} |