Skip to content

Commit

Permalink
Update update_references.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
jacoblogan authored Sep 6, 2024
1 parent ef29662 commit 19ab4f4
Showing 1 changed file with 30 additions and 21 deletions.
51 changes: 30 additions & 21 deletions .github/workflows/update_references.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,35 @@ on:
repository_dispatch:
types: [update-references]
workflow_dispatch:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
create-pull-request:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- name: Set Branch Name
run: echo "BRANCH_NAME=$(echo $(date +%s))" >> $GITHUB_ENV
- name: Create new branch
run: |
git config user.email "[email protected]"
git config user.name "Your Name"
git checkout -b ${{ env.BRANCH_NAME }}
curl -L -o ${{ vars.REF_LOC }} ${{ vars.REMOTE_REF }}
git add ${{ vars.REF_LOC }}
git commit -m "updating references"
git push -u origin ${{ env.BRANCH_NAME }}
- name: Create Pull Request
run: gh pr create -B main -H ${{ env.BRANCH_NAME }} --title 'Merge ${{ env.BRANCH_NAME }} into main' --body 'Created by Github action'

create-pull-request:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6

- name: Setup Node.js 20
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: 20.x

# Set branch name to be used as environment variable
- name: Set Branch Name
run: echo "BRANCH_NAME=$(echo $(date +%s))" >> $GITHUB_ENV

# Create new branch, download, and commit changes to the new branch
- name: Create new branch
run: |
git checkout -b ${{ env.BRANCH_NAME }}
curl -L -o ${{ vars.REF_LOC }} ${{ vars.REMOTE_REF }}
node tasks/clean-references.mjs
git add ${{ vars.REF_LOC }} ${{ vars.CLEAN_LOC }}
git commit -m "updating references"
git push -u origin ${{ env.BRANCH_NAME }}
# Open pull request
- name: Create Pull Request
run: gh pr create -B main -H ${{ env.BRANCH_NAME }} --title 'Merge ${{ env.BRANCH_NAME }} into main' --body 'Created by Github action'

0 comments on commit 19ab4f4

Please sign in to comment.