-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (46 loc) · 1.55 KB
/
merge-to-production.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
name: Test data and merge to production
on:
push:
branches: main
env:
GITHUB_TOKEN: ${{ secrets.CI_TOKEN }}
MERGE_FROM_BRANCH: main
MERGE_TO_BRANCH: production
jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install Hakai Tests
run: |
python -m pip install --upgrade pip
pip install git+https://HakaiInstitute:${{secrets.CI_TOKEN}}@github.com/HakaiInstitute/hakai-datasets-repo-standard-tests.git
- name: Test with pytest
run: |
pytest --pyargs hakai_data_repo_tests
production-merge:
runs-on: ubuntu-latest
env:
PR_STATUS: ''
steps:
- uses: actions/checkout@v3
- name: Set PR status as environment variable
run: |
echo 'PR_STATUS<<EOF' >> $GITHUB_ENV
gh pr status >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
- name: Create Pull Request
if: ${{contains(env.PR_STATUS, 'There is no pull request associated with [main]')}}
run: |
gh pr create -H ${{env.MERGE_FROM_BRANCH}} -B ${{env.MERGE_TO_BRANCH}} --title "Merge latest changes to main into production branch" --body-file ".github/workflows/production-merge-pull-request-body.md"
merge:
runs-on: ubuntu-latest
needs: [tests, production-merge]
steps:
- uses: actions/checkout@v3
- name: Auto-merge pull requests
run: gh pr merge --auto --merge