File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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
You can’t perform that action at this time.
0 commit comments