Mengganti branch menjadi master #1
Workflow file for this run
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: Push to PWS | |
on: | |
push: | |
branches: [ master ] | |
paths-ignore: | |
- '**.md' | |
pull_request: | |
branches: [ master ] | |
paths-ignore: | |
- '**.md' | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Set up Git | |
run: | | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
- name: Check PWS remote, pull, merge, and push | |
env: | |
PWS_URL: ${{ secrets.PWS_URL }} | |
run: | | |
# Check if master branch exists locally | |
if ! git show-ref --verify --quiet refs/heads/master; then | |
echo "Creating master branch" | |
git branch master | |
fi | |
# Switch to master branch | |
git checkout master | |
# Push to master branch and capture the output | |
push_output=$(git push $PWS_URL master:master 2>&1) | |
if [[ $? -ne 0 ]]; then | |
echo "Push failed with output: $push_output" | |
echo "Error: Unable to push changes. Please check the error message above and resolve any conflicts manually." | |
exit 1 | |
fi | |
echo "Push successful with output: $push_output" |