From 15b0b557573209612d36aa797a681661466d9f49 Mon Sep 17 00:00:00 2001 From: Soufiane Fariss Date: Tue, 26 Nov 2024 15:30:07 +0100 Subject: [PATCH] ci: explorer web: modify web-release to open a PR --- .github/workflows/web-release.yml | 32 +++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/.github/workflows/web-release.yml b/.github/workflows/web-release.yml index 4dedff923..5dea0cdb5 100644 --- a/.github/workflows/web-release.yml +++ b/.github/workflows/web-release.yml @@ -14,6 +14,9 @@ jobs: build-and-release: needs: run-tests runs-on: ubuntu-latest + permissions: + contents: write # required to create a branch + pull-requests: write # required to open a Pull Request steps: - uses: actions/checkout@v4 @@ -69,11 +72,36 @@ jobs: run: ls -t capa-explorer-web-v*.zip | tail -n +4 | xargs -r rm -- working-directory: web/explorer/releases - - name: Commit and push release + - name: Create Pull Request run: | + # create a new branch git config --local user.email "capa-dev@mandiant.com" git config --local user.name "Capa Bot" + BRANCH_NAME="release/web-v${{ github.event.inputs.version }}" + git checkout -b $BRANCH_NAME + + # add and commit changes git add -f web/explorer/releases/${{ env.RELEASE_NAME }}.zip web/explorer/releases/CHANGELOG.md git add -u web/explorer/releases/ git commit -m ":robot: explorer web: add release ${{ env.RELEASE_NAME }}" - git push + + # push the branch + git push origin $BRANCH_NAME + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v6 + with: + token: ${{ secrets.GITHUB_TOKEN }} + title: ":package: add new Explorer Web v${{ github.event.inputs.version }}" + body: | + This PR adds a new capa Explorer Web release v${{ github.event.inputs.version }}. + + Release details: + - Name: ${{ env.RELEASE_NAME }} + - SHA256: ${{ env.RELEASE_SHA256 }} + + This PR was automatically created by the web release workflow. + branch: release/web-v${{ github.event.inputs.version }} + base: master + labels: release + delete-branch: true