forked from mozilla/gecko-dev
-
Notifications
You must be signed in to change notification settings - Fork 1
45 lines (40 loc) · 1.65 KB
/
pull-upstream.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
name: "Pull from upstream"
on:
schedule:
- cron: "0 */12 * * *" # every 12 hours
workflow_dispatch:
inputs:
skip_version_check:
description: "Skip checking upstream version"
required: true
type: boolean
jobs:
pull:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
repository: 'dothq/gecko-dev-scripts'
- name: Install dependencies
run: npm install
- name: Compare versions
run: |
ROBOT_TOKEN=${{ secrets.ROBOT_TOKEN }} node src/compare-versions.js ${{ inputs.skip_version_check == false && vars.PREV_CHECK_VERSION || '1.0.0' }}
- name: Store current version
if: ${{ inputs.skip_version_check == false }}
env:
GH_TOKEN: ${{ secrets.ROBOT_TOKEN }}
run: |
CURRENT_VERSION=$(cat current_version.txt)
gh api --method POST \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/repos/dothq/gecko-dev/actions/variables \
-f name='PREV_CHECK_VERSION' \
-f value="$CURRENT_VERSION" || true
gh api --method PATCH \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/repos/dothq/gecko-dev/actions/variables/PREV_CHECK_VERSION \
-f name='PREV_CHECK_VERSION' \
-f value="$CURRENT_VERSION"