Skip to content

Merge branch 'master' of /~https://github.com/SN-Koarashi/ig-helper #28

Merge branch 'master' of /~https://github.com/SN-Koarashi/ig-helper

Merge branch 'master' of /~https://github.com/SN-Koarashi/ig-helper #28

Workflow file for this run

name: Build Userscript File
on:
push:
branches:
- master
jobs:
build:
if: contains(github.event.head_commit.message, 'Automated Build PR') == false
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: "20"
- name: Setup GitHub CLI
run: |
sudo apt-get install gh
- name: Configure Git
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
- name: Check if automated-build-branch exists and checkout
run: |
git fetch origin
if git show-ref --quiet refs/heads/automated-build-branch; then
git checkout automated-build-branch
else
git checkout -b automated-build-branch
fi
- name: Check if remote automated-build-branch exists and pull
run: |
if git ls-remote --heads origin automated-build-branch | grep -q automated-build-branch; then
git pull --rebase --strategy-option theirs origin automated-build-branch || echo "There were conflicts that were automatically resolved using 'theirs'."
else
echo "Remote branch automated-build-branch does not exist."
fi
- name: Install dependencies
run: npm install
- name: Run build script
run: node ./build.js
- name: Run ESLint
run: npx eslint main.js --quiet
- name: Check for changes before committing
run: |
if [ -n "$(git status --porcelain)" ]; then
git add .
git commit -m "Automated build commit"
git push origin automated-build-branch
else
echo "No changes to commit"
exit 0
fi
- name: Create Pull Request
run: |
gh auth login --with-token <<< "${{ secrets.GITHUB_TOKEN }}"
gh pr create --base master --head automated-build-branch --title "Automated Build PR" --body "This PR is automatically generated by GitHub Actions."