forked from duckduckgo/Android
-
Notifications
You must be signed in to change notification settings - Fork 0
125 lines (106 loc) · 5.2 KB
/
update-content-scope.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
name: Update Content Scope Scripts
on:
schedule:
- cron: '30 1 * * *' # run at 1 AM UTC
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
update-content-scope-scripts:
name: Update Content Scope scripts
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: recursive
- name: Install npm-check-updates
run: npm install -g npm-check-updates
- name: Check for updates
id: update-check
continue-on-error: true
run: ncu @duckduckgo/content-scope-scripts --errorLevel 2
- name: Update content scope scripts
if: ${{ steps.update-check.outcome == 'failure' }}
run: ncu @duckduckgo/content-scope-scripts -u
- name: Install package
if: ${{ steps.update-check.outcome == 'failure' }}
run: npm update
- name: Find latest release version of Content Scope scripts in package.json
if: ${{ steps.update-check.outcome == 'failure' }}
id: find-latest-release
uses: notiz-dev/github-action-json-property@release
with:
path: 'package.json'
prop_path: 'dependencies.@duckduckgo/content-scope-scripts'
- name: Extract release version
if: ${{ steps.update-check.outcome == 'failure' }}
uses: rishabhgupta/split-by@v1
id: extract-release-version
with:
string: ${{steps.find-latest-release.outputs.prop}}
split-by: '#'
- name: Create Pull Request in Android repo
if: ${{ steps.update-check.outcome == 'failure' }}
env:
RELEASE_VERSION: ${{ steps.extract-release-version.outputs._1}}
id: create-pr
uses: peter-evans/create-pull-request@v5.0.2
with:
base: "develop"
title: Update content scope scripts to version ${{ steps.extract-release-version.outputs._1}}
author: daxmobile <daxmobile@users.noreply.github.com>
token: ${{ secrets.GT_DAXMOBILE }}
commit-message: Update content scope scripts to version ${{ steps.extract-release-version.outputs._1}}
labels: content scope scripts, automated pr
branch: automated/update-content-scope-scripts-dependencies-${{ steps.extract-release-version.outputs._1}}
body: |
- Automated content scope scripts dependency update
This PR updates the content scope scripts dependency to the latest available version and copies the necessary files.
If tests have failed, see https://app.asana.com/0/1202561462274611/1203986899650836/f for further information on what to do next.
- [ ] All tests must pass
- name: Create Asana task in Android App project
if: ${{ steps.update-check.outcome == 'failure' }}
id: create-task
uses: duckduckgo/native-github-asana-sync@v1.1
with:
asana-pat: ${{ secrets.GH_ASANA_SECRET }}
asana-project: ${{ vars.GH_ANDROID_APP_PROJECT_ID }}
asana-section: ${{ vars.GH_ANDROID_APP_INCOMING_SECTION_ID }}
asana-task-name: Update content scope scripts to version ${{ steps.extract-release-version.outputs._1}}
asana-task-description: |
Content scope scripts have been updated and a PR created.
If tests failed check out https://app.asana.com/0/1202561462274611/1203986899650836/f for further information on what to do next.
See ${{ steps.create-pr.outputs.pull-request-url }}
action: 'create-asana-task'
- name: Add Asana task to Release Board project
if: ${{ steps.create-task.outputs.duplicate == 'false' }}
uses: duckduckgo/native-github-asana-sync@v1.1
with:
asana-pat: ${{ secrets.GH_ASANA_SECRET }}
asana-project: ${{ vars.GH_ANDROID_RELEASE_BOARD_PROJECT_ID }}
asana-section: ${{ vars.GH_ANDROID_RELEASE_BOARD_PR_SECTION_ID }}
asana-task-id: ${{ steps.create-task.outputs.taskId }}
action: 'add-task-asana-project'
- name: Update PR description with Asana task
if: ${{ steps.create-task.outputs.duplicate == 'false' }}
uses: duckduckgo/native-github-asana-sync@v1.1
with:
github-pat: ${{ secrets.GT_DAXMOBILE }}
github-pr: ${{ steps.create-pr.outputs.pull-request-number }}
github-repository: 'android'
github-org: 'duckduckgo'
asana-project: ${{ vars.GH_ANDROID_RELEASE_BOARD_PROJECT_ID }}
asana-task-id: ${{ steps.create-task.outputs.taskId }}
action: 'add-task-pr-description'
- name: Create Asana task when workflow failed
if: ${{ failure() }}
uses: duckduckgo/native-github-asana-sync@v1.1
with:
asana-pat: ${{ secrets.GH_ASANA_SECRET }}
asana-project: ${{ vars.GH_ANDROID_APP_PROJECT_ID }}
asana-section: ${{ vars.GH_ANDROID_APP_INCOMING_SECTION_ID }}
asana-task-name: GH Workflow Failure - Update content scope scripts
asana-task-description: The update content scope scripts tests workflow has failed. See https://github.com/duckduckgo/Android/actions/runs/${{ github.run_id }}
action: 'create-asana-task'