change actions yml #3
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: | |
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: Commit compiled files | |
run: | | |
git add -f main.js | |
git commit -m "Automated build commit" || echo "No changes to commit" | |
- name: Push changes to a new branch | |
run: | | |
git push origin HEAD: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." |