-
Notifications
You must be signed in to change notification settings - Fork 18
82 lines (72 loc) · 2.55 KB
/
upstream_update.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
name: Check development branch accounts for upstream updates
on:
schedule:
- cron: '5 * * * *' # every hour, 5 mins past the hour
workflow_dispatch: # manual trigger
env:
ROOT: "main"
SCION: "dev"
jobs:
check_branches:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # necessary to access all commits
ref: ${{ env.SCION }}
- run: git fetch origin
- name: Check if SCION is an extension of ROOT
id: check
run: |
ROOT_COMMIT=$(git rev-parse origin/${{ env.ROOT }})
SCION_COMMIT=$(git rev-parse HEAD)
if git merge-base --is-ancestor $ROOT_COMMIT HEAD; then
echo "status=true" >> $GITHUB_ENV
echo "message=$SCION is rebased on $ROOT as of $SCION_COMMIT" >> $GITHUB_ENV
else
echo "status=false" >> $GITHUB_ENV
echo "message=$SCION at $SCION_COMMIT does not include $ROOT at $ROOT_COMMIT" >> $GITHUB_ENV
fi
shell: bash
- name: Find the last report issue open
id: last_issue
uses: micalevisk/last-issue-action@v2
with:
state: open
labels: |
upstream
automated issue
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Debug
run: |
echo ${{ env.status }}
echo ${{ env.message }}
echo ${{ steps.last_issue.outputs.has-found }}
echo ${{ steps.last_issue.outputs.issue-number }}
- name: Close last report open issue
if: env.status == 'true' && steps.last_issue.outputs.has-found == 'true'
uses: peter-evans/close-issue@v3
with:
issue-number: ${{ steps.last_issue.outputs.issue-number }}
comment: ${{ env.message }}
- name: Update last report open issue
if: env.status == 'false' && steps.last_issue.outputs.has-found == 'true'
uses: peter-evans/create-or-update-comment@v4
with:
issue-number: ${{ steps.last_issue.outputs.issue-number }}
body: ${{ env.message }}
edit-mode: replace
- name: Create file for issue
if: env.status == 'false' && steps.last_issue.outputs.has-found == 'false'
run: echo "${{ env.message }}" > ./_body.md
- name: Create issue from report
if: env.status == 'false' && steps.last_issue.outputs.has-found == 'false'
uses: peter-evans/create-issue-from-file@v5
with:
title: ${{ env.SCION }} needs to be rebased on ${{ env.ROOT }}
content-filepath: ./_body.md
assignees: huitseeker
labels: |
upstream
automated issue