forked from google-deepmind/concordia
-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (63 loc) · 2.09 KB
/
update-requirements.yml
File metadata and controls
71 lines (63 loc) · 2.09 KB
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
60
61
62
63
64
65
66
67
68
69
70
71
name: update-requirements
on:
schedule:
- cron: "0 2 1 * *" # First day of every month at 2am.
push:
branches:
- main
paths:
- '.github/workflows/update-requirements.yml'
- 'examples/requirements.in'
- 'setup.py'
pull_request:
branches:
- main
paths:
- '.github/workflows/update-requirements.yml'
- 'examples/requirements.in'
- 'setup.py'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
permissions: read-all
jobs:
update-requirements:
name: Test examples
runs-on: ubuntu-latest
timeout-minutes: 90
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout Melting Pot
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- name: Install Melting Pot
uses: ./.github/actions/install
- name: Compile requirements.txt
run: pip-compile --generate-hashes --strip-extras --output-file=requirements.txt --extra=dev setup.py examples/requirements.in
- name: Check for changes
id: check_changes
run: |
if git diff --quiet; then
echo "changed=false" >> $GITHUB_OUTPUT
else
echo "changed=true" >> $GITHUB_OUTPUT
fi
- name: Create pull request
if: steps.check_changes.outputs.changed == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
BRANCH_NAME="update-requirements-$(date +%Y%m%d%H%M%S)"
git checkout -b "${BRANCH_NAME}"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "GitHub Actions Bot"
git add requirements.txt
git commit -m "Update requirements.txt"
git push origin "$BRANCH_NAME"
gh pr create \
--base "${GITHUB_BASE_REF:-main}" \
--head "$BRANCH_NAME" \
--title "Update requirements.txt" \
--body 'Automatically generated by GitHub Action.'