Skip to content

Commit bfa6780

Browse files
committed
first pass at automating appending/prepending/removing version from supported cli versions
1 parent 80f588c commit bfa6780

1 file changed

Lines changed: 56 additions & 0 deletions

File tree

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Version Change
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
option:
6+
description: "Option"
7+
required: true
8+
default: 'append'
9+
type: choice
10+
options:
11+
- append
12+
- prepend
13+
- remove
14+
version:
15+
description: "Version"
16+
required: true
17+
type: string
18+
19+
permissions:
20+
contents: write
21+
pull-requests: write
22+
23+
jobs:
24+
build:
25+
name: Build
26+
runs-on: ubuntu-latest
27+
steps:
28+
- name: Checkout
29+
uses: actions/checkout@v3
30+
with:
31+
fetch-depth: 1
32+
- name: Remove Version
33+
if: ${{ inputs.option == 'remove' }}
34+
run: |
35+
cat supported_cli_versions.json | jq 'del(.[] | select(. == "${{ inputs.version }}"))' > supported_cli_versions_temp.json
36+
- name: Append Version
37+
if: ${{ inputs.option == 'append' }}
38+
run: |
39+
cat supported_cli_versions.json | jq '. += ["${{ inputs.version }}"]' > supported_cli_versions_temp.json
40+
- name: Prepend Version
41+
if: ${{ inputs.option == 'prepend' }}
42+
run: |
43+
cat supported_cli_versions.json | jq '. |= ["${{ inputs.version }}"] + .' > supported_cli_versions_temp.json
44+
- name: Move temp file to supported_cli_versions.json
45+
run: |
46+
mv supported_cli_versions_temp.json supported_cli_versions.json
47+
- name: Commit, Push and Open a PR
48+
uses: ./.github/actions/create-pr
49+
with:
50+
token: ${{ secrets.GITHUB_TOKEN }}
51+
base-branch: main
52+
head-branch: github-action/version-change
53+
commit-message: ${{ inputs.option }} ${{ inputs.version }}
54+
title: ${{ inputs.option }} ${{ inputs.version }} from/in supported_cli_versions.json
55+
body: >
56+
${{ inputs.option }} ${{ inputs.version }} from/in supported_cli_versions.json

0 commit comments

Comments
 (0)