funkanudå!?!?! #13
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Create PR on Issue Creation | |
on: | |
issues: | |
types: [opened] | |
jobs: | |
create-pr: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Node.js (required for octokit) | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "14" | |
- name: Create a new branch | |
run: | | |
git config --global user.name 'github-actions' | |
git config --global user.email '[email protected]' | |
git checkout -b add-helloworld-file | |
- name: Create helloworld.txt | |
run: echo 'Hello, World!' > helloworld.txt | |
- name: Commit changes | |
run: | | |
git add helloworld.txt | |
git commit -m 'Add helloworld.txt' | |
- name: Fetch latest changes from remote | |
run: git fetch origin | |
- name: Ensure branch is up-to-date with remote | |
run: | | |
git pull origin add-helloworld-file --allow-unrelated-histories || true | |
- name: Push changes | |
run: | | |
git push --force-with-lease --set-upstream origin add-helloworld-file | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Check git status | |
run: | | |
echo "Checking the status of the repository" | |
git status | |
echo "Differences between main and add-helloworld-file" | |
git diff main..add-helloworld-file | |
- name: Create Pull Request | |
id: create_pr | |
uses: peter-evans/create-pull-request@v5 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
commit-message: "Add helloworld.txt" | |
base: main | |
branch: add-helloworld-file | |
title: "Add helloworld.txt" | |
body: "This PR adds a helloworld.txt file." |