test actions #16
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: 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: Install dependencies | |
run: npm install | |
- name: Run build script | |
run: node ./build.js | |
- 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 for changes before committing | |
run: | | |
if [ -n "$(git status --porcelain)" ]; then | |
git add . | |
git commit -m "Automated build commit" | |
else | |
echo "No changes to commit" | |
exit 0 | |
fi | |
- name: Create branch if it does not exist | |
run: | | |
git checkout -b automated-build-branch || git checkout automated-build-branch | |
- name: Push changes to automated-build-branch | |
run: | | |
git push origin automated-build-branch | |
- 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." |