From 2821b054ec78a214ecb733b3b5bc5acec978c44c Mon Sep 17 00:00:00 2001 From: Przemek Rzad Date: Mon, 11 Mar 2024 14:59:38 +0100 Subject: [PATCH] Introduce a post-merge test PR (#38) --- .github/workflows/create-pr.yml | 47 ++++++++++++++++++++++++++++++++ .github/workflows/rfc-action.yml | 1 + 2 files changed, 48 insertions(+) create mode 100644 .github/workflows/create-pr.yml diff --git a/.github/workflows/create-pr.yml b/.github/workflows/create-pr.yml new file mode 100644 index 0000000..3eb2e71 --- /dev/null +++ b/.github/workflows/create-pr.yml @@ -0,0 +1,47 @@ +name: Create a test PR after merge + +on: + push: + branches: + - main + +permissions: + contents: write + pull-requests: write + +jobs: + create-pr: + name: Create a test PR after merge + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v3 + + # We need a fresh base branch every time, + # so that it doesn't contain the text that we want to merge with the PR. + - name: Generate branch names + id: generate_branches + run: | + timestamp=$(date +%Y-%m-%dT%H-%M) + echo "base_branch=test_base_$timestamp" >> $GITHUB_OUTPUT + echo "head_branch=test_head_$timestamp" >> $GITHUB_OUTPUT + + - name: Create a base branch + run: | + git push origin HEAD:${{ steps.generate_branches.outputs.base_branch }} + + - name: Create the changes for the PR + run: | + mkdir text + cp src/examples/0014-improve-locking-mechanism-for-parachains.md ./text/ + + - name: Create a test PR + uses: peter-evans/create-pull-request@5b4a9f6a9e2af26e5f02351490b90d01eb8ec1e5 # v5 + with: + base: ${{ steps.generate_branches.outputs.base_branch }} + branch: ${{ steps.generate_branches.outputs.head_branch }} + add-paths: | + text/*.md + title: "[Post-merge test] A test PR for testing the action" + body: "@paritytech/opstooling This is a test PR created automatically because a recent change has been merged to master.\nUse `/rfc process 0x39fbc57d047c71f553aa42824599a7686aea5c9aab4111f6b836d35d3d058162` to process the PR and test out the code on `main`." diff --git a/.github/workflows/rfc-action.yml b/.github/workflows/rfc-action.yml index a0745e7..06a7585 100644 --- a/.github/workflows/rfc-action.yml +++ b/.github/workflows/rfc-action.yml @@ -6,6 +6,7 @@ on: permissions: pull-requests: write + contents: write jobs: rfc-action: