Skip to content

update-references

update-references #33

name: Receive repository dispatch event
on:
# Listen to a repository dispatch event by the name of `dispatch-event`
repository_dispatch:
types: [update-references]
workflow_dispatch:
permissions:
contents: write
pull-requests: write
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: Setup Node.js 20
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version: 20.x
- name: Set github commit user
env:
GITHUB_EMAIL: ${{ vars.GH_EMAIL }}
GITHUB_USER: ${{ vars.GH_USER }}
run: |
git config --global user.email $GITHUB_EMAIL
git config --global user.name $GITHUB_USER
# Set branch name to be used as environment variable
- name: Set Branch Name
run: echo "BRANCH_NAME=$(echo update-ref-$(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'