forked from mozilla-partners/mozillaonline
-
Notifications
You must be signed in to change notification settings - Fork 0
92 lines (82 loc) · 3.24 KB
/
create-pr.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
name: Create PR
on:
workflow_dispatch:
inputs:
month:
description: 'Month to use in distribution version'
required: true
version:
description: 'Firefox version to target'
required: true
year:
description: 'Year to use in distribution version'
required: true
jobs:
create-pr:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ endsWith(github.event.inputs.version, 'esr') && 'esr' || 'master' }}
- name: Set up Python 3.9
uses: actions/setup-python@v3
with:
python-version: 3.9
cache: 'pip'
cache-dependency-path: 'desktop/scripts/requirements.txt'
- name: Install dependencies
run: |
cd desktop/scripts
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Fetch the latest extensions
run: |
cd desktop/scripts
python fetch-extensions.py
env:
TASKCLUSTER_ROOT_URL: https://firefox-ci-tc.services.mozilla.com
TASKCLUSTER_CLIENT_ID: ${{ secrets.TASKCLUSTER_CLIENT_ID }}
TASKCLUSTER_ACCESS_TOKEN: ${{ secrets.TASKCLUSTER_ACCESS_TOKEN }}
- name: Update distribution.ini for variants
run: |
cd desktop/scripts
python update-dist.py ini -y ${{ github.event.inputs.year }} -m ${{ github.event.inputs.month }}
- name: Update extensions for variants
run: |
cd desktop/scripts
python update-dist.py extension
- name: Commit the changes
run: |
git add desktop
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
git checkout -b ${{ endsWith(github.event.inputs.version, 'esr') && 'esr' || 'release' }}-fx${{ github.event.inputs.version }}
git commit -m "Updates for Fx ${{ github.event.inputs.version }}"
git push origin ${{ endsWith(github.event.inputs.version, 'esr') && 'esr' || 'release' }}-fx${{ github.event.inputs.version }} -f
- name: Create PR
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const result = await github.rest.pulls.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: "Updates for Fx ${{ github.event.inputs.version }}",
head: "${{ endsWith(github.event.inputs.version, 'esr') && 'esr' || 'release' }}-fx${{ github.event.inputs.version }}",
base: "${{ endsWith(github.event.inputs.version, 'esr') && 'esr' || 'master' }}",
maintainer_can_modify: false,
});
if (result.status == 201 && result.data && result.data.number) {
github.rest.issues.addAssignees({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: result.data.number,
assignees: ["l-hedgehog"],
});
github.rest.pulls.requestReviewers({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: result.data.number,
reviewers: ["xjc2694"],
});
}