-
-
Notifications
You must be signed in to change notification settings - Fork 29
53 lines (46 loc) · 1.64 KB
/
check_releases.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
name: Check for new tags on repositories
on:
schedule:
- cron: 42 2 * * *
workflow_dispatch:
permissions:
contents: write
pull-requests: write
jobs:
prepare_release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.9"
- name: Install dependencies
run: |
python -m pip install -r requirements.txt
- name: Check for new releases
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
python scripts/01_check_releases.py
- name: Create a PR optionally
shell: bash
env:
GITHUB_USER: ${{ secrets.GITHUB_USER }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -eux
if [[ ! -z "$(git status --porcelain repository-map.yml)" ]]; then
export SHA=$(git rev-parse --short HEAD)
export BRANCH_NAME=new-release-${SHA}
git checkout -b "${BRANCH_NAME}"
git config user.name "JupyterLab Language Packs Bot"
git config user.email '[email protected]'
# Needed for hub to create the pull request correctly
# Ref: https://github.com/github/hub/issues/1538 https://github.com/github/hub/pull/1705
git remote set-head origin --auto
git add repository-map.yml
git commit -m "New releases"
git push --set-upstream origin "${BRANCH_NAME}"
gh pr create -B "main" -t "New releases available at ${SHA}" -b ""
fi