-
Notifications
You must be signed in to change notification settings - Fork 1
59 lines (59 loc) · 2.54 KB
/
update_repos.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
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@v3
- 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 }}