|
| 1 | +name: Update VSCode Extension |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + version: |
| 7 | + description: 'Version to update to' |
| 8 | + required: true |
| 9 | + type: string |
| 10 | + workflow_call: |
| 11 | + inputs: |
| 12 | + version: |
| 13 | + description: 'Version to update to' |
| 14 | + required: true |
| 15 | + type: string |
| 16 | + |
| 17 | +jobs: |
| 18 | + update-ggshield-version: |
| 19 | + runs-on: ubuntu-latest |
| 20 | + steps: |
| 21 | + - name: Checkout VSCode extension repo |
| 22 | + uses: actions/checkout@v4 |
| 23 | + with: |
| 24 | + repository: GitGuardian/gitguardian-vscode |
| 25 | + token: ${{ secrets.PAT_GITHUB }} |
| 26 | + sparse-checkout: | |
| 27 | + ggshield_version |
| 28 | + sparse-checkout-cone-mode: false |
| 29 | + |
| 30 | + - name: Create branch |
| 31 | + run: | |
| 32 | + git config --global user.name 'GitHub Actions' |
| 33 | + git config --global user.email '[email protected]' |
| 34 | + git checkout -b update-ggshield-to-${{ inputs.version }} |
| 35 | +
|
| 36 | + - name: Update ggshield_version file |
| 37 | + run: | |
| 38 | + version="${{ inputs.version }}" |
| 39 | + version="${version#v}" # Remove leading 'v' if present |
| 40 | + echo "$version" > ggshield_version |
| 41 | +
|
| 42 | + - name: Commit changes |
| 43 | + run: | |
| 44 | + git add ggshield_version |
| 45 | + git commit -m "Update ggshield version to ${{ inputs.version }}" |
| 46 | +
|
| 47 | + - name: Push changes |
| 48 | + run: | |
| 49 | + git push --set-upstream origin update-ggshield-to-${{ inputs.version }} --force |
| 50 | +
|
| 51 | + - name: Create pull request |
| 52 | + env: |
| 53 | + GH_TOKEN: ${{ secrets.PAT_GITHUB }} |
| 54 | + run: | |
| 55 | + gh pr create \ |
| 56 | + --repo GitGuardian/gitguardian-vscode \ |
| 57 | + --title "Update ggshield version to ${{ inputs.version }}" \ |
| 58 | + --body "This PR updates the bundled ggshield CLI to version ${{ inputs.version }}. This update was automatically generated by a worflow on ggshield repository." \ |
| 59 | + --base main \ |
| 60 | + --head update-ggshield-to-${{ inputs.version }} |
0 commit comments