-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
64 additions
and
11 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
name: Create Pull Request on Issue Creation | ||
|
||
on: | ||
issues: | ||
types: [opened] | ||
|
||
jobs: | ||
create-pull-request: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Run update-exiftool | ||
id: create-branch | ||
run: | | ||
git config --global user.email daniel@woss.io | ||
git config --global user.name "Woss Bot" | ||
rm -rf exiftool_git | ||
git clone https://github.com/exiftool/exiftool.git exiftool_git | ||
rm -rf exiftool_git/.git | ||
cd ./exiftool_git || exit | ||
perl Makefile.PL | ||
make | ||
make test | ||
cd ../ | ||
mkdir -p ./exiftool | ||
cp -R ./exiftool_git/lib ./exiftool_git/exiftool ./exiftool | ||
chmod +x ./exiftool/exiftool | ||
rm -rf exiftool_git | ||
VERSION=$(./exiftool/exiftool -ver) | ||
echo "Version: ${VERSION}" | ||
git checkout -b "v${VERSION}" | ||
git add exiftool | ||
git commit -m "Update exiftool to version ${VERSION}" | ||
git push --set-upstream origin "v${VERSION}" | ||
echo "branchName=v${VERSION}" >> $GITHUB_OUTPUT | ||
- name: Create Pull Request | ||
uses: actions/github-script@v6 | ||
with: | ||
script: | | ||
const issue = context.payload.issue; | ||
const branchName = '${{ steps.create-branch.outputs.branchName }}'; | ||
const title = `Fix for #${issue.number}: ${issue.title}`; | ||
const body = `This pull request addresses the issue #${issue.number}.`; | ||
const { data: pullRequest } = await github.pulls.create({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
title: title, | ||
body: body, | ||
head: branchName, | ||
base: 'main' | ||
}); | ||
console.log(`Pull Request created: ${pullRequest.html_url}`); |