-
Notifications
You must be signed in to change notification settings - Fork 5
100 lines (85 loc) · 3.16 KB
/
sync-app-version.yaml
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
name: Sync appVersion
# TODO: add description of this action
on:
workflow_dispatch:
inputs:
app_version:
description: Scalr Agent version in format x.y.z (without `agent/` prefix).
required: true
type: string
upstream:
description: |
This input is used to link the dispatch with the upstream. It will be
as prefix in PR name.
required: true
type: string
env:
PR_BRANCH: 'actions/sync-app-version-${{ inputs.app_version }}'
jobs:
sync-app-version:
name: Sync appVersion
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: printenv
shell: bash
run: printenv
- name: Main
uses: ./.github/actions/sync-app-version
with:
app_version: ${{inputs.app_version}}
upstream: ${{inputs.upstream}}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# - name: Commit Changes
# shell: bash
# run: |-
# git config user.name "github-actions[bot]"
# git config user.email "github-actions[bot]@users.noreply.github.com"
# git checkout -b $PR_BRANCH
# git status
# git add .
# git commit -m "Release: ${{steps.update.outputs.version}}"
# git push origin $PR_BRANCH --force
# - name: 'Create Pull Request'
# uses: 'actions/github-script@v6'
# with:
# script: |-
# const tag = "v" + process.env.NEW_VERSION;
# try {
# const listResponse = await github.rest.pulls.list({
# owner: context.repo.owner,
# repo: context.repo.repo,
# state: "open",
# head: context.repo.owner + ":" + process.env.PR_BRANCH,
# base: process.env.GITHUB_REF_NAME,
# });
# core.isDebug() && console.log(listResponse);
# if (!listResponse.data.length) {
# const createResponse = await github.rest.pulls.create({
# owner: context.repo.owner,
# repo: context.repo.repo,
# title: "Release: " + tag,
# body: process.env.RELEASE_NOTES,
# head: process.env.PR_BRANCH,
# base: process.env.GITHUB_REF_NAME,
# });
# core.info(
# `Created PR #${createResponse.data.number} at ${createResponse.data.html_url}`
# );
# } else {
# const updateResponse = await github.rest.pulls.update({
# owner: context.repo.owner,
# repo: context.repo.repo,
# pull_number: listResponse.data[0].number,
# title: "Release: " + tag,
# body: process.env.RELEASE_NOTES,
# });
# core.info(
# `Updated PR #${updateResponse.data.number} at ${updateResponse.data.html_url}`
# );
# }
# } catch (err) {
# console.error(err);
# core.setFailed(`Failed to create pull request: ${err}`);
# }