diff --git a/.github/workflows/auto-draft-pr.yaml b/.github/workflows/pr-preparation.yaml similarity index 56% rename from .github/workflows/auto-draft-pr.yaml rename to .github/workflows/pr-preparation.yaml index 2de9158a170..846ad718ca7 100644 --- a/.github/workflows/auto-draft-pr.yaml +++ b/.github/workflows/pr-preparation.yaml @@ -18,20 +18,41 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -name: Convert PRs to Draft on Opening - -permissions: - contents: write +name: Pull Request preparation on: pull_request: types: [opened] jobs: - convert_to_draft: + prepare_pr: + name: Prepare pull request + if: ${{ github.event.pull_request.head.repo.full_name == github.repository }} runs-on: ubuntu-latest steps: - - run: gh pr ready --undo ${{ github.event.pull_request.number }} + - name: Checkout PR branch + uses: actions/checkout@v6 + with: + ref: ${{ github.event.pull_request.head.ref }} + ssh-key: ${{ secrets.SSH_FAFOREVER_MACHINE_USER }} + + - name: Add snippet + working-directory: changelog/snippets + run: | + # Configure git + git config user.email "github@faforever.com" + git config user.name "FAForever Machine User" + + FILE=category.${{ github.event.pull_request.number }}.md + cp sections/template-snippet.md $FILE + sed -i "s/XYZW/${{ github.event.pull_request.number }}/g" $FILE + + git add . + git commit -m "Add snippet template" + git push + + - name: Convert PR to draft + run: gh pr ready --undo ${{ github.event.pull_request.number }} env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} GH_REPO: ${{ github.repository }} diff --git a/changelog/snippets/sections/template-snippet.md b/changelog/snippets/sections/template-snippet.md new file mode 100644 index 00000000000..6dd6508f92e --- /dev/null +++ b/changelog/snippets/sections/template-snippet.md @@ -0,0 +1 @@ +- Your explanation here... [Don't forget to change the category in the filename] (#XYZW).