feat(v22): Handle all headers #2
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: Headers update | |
on: | |
workflow_dispatch: | |
pull_request: | |
branches: [ make-v22 ] # todo rm | |
schedule: | |
- cron: "0 0 * * 0" # Runs every Sunday at midnight UTC | |
jobs: | |
run-bash-and-pr: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- uses: fregante/setup-git-user@v2 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Install dependencies | |
run: yarn install | |
- name: Check for new headers on IANA.ORG | |
run: yarn build:headers | |
- name: Check for changes | |
id: git-state | |
run: | | |
if [ -n "$(git status --porcelain)" ]; then | |
echo "changes=true" >> $GITHUB_OUTPUT | |
else | |
echo "changes=false" >> $GITHUB_OUTPUT | |
fi | |
- name: Create branch, commit, and push changes | |
if: steps.git-state.outputs.changes == 'true' | |
run: | | |
BRANCH_NAME="headers-update-$(date +%Y%m%d)" | |
git checkout -b $BRANCH_NAME | |
git add . | |
git commit -m "Changed well-known headers on $(date +%Y-%m-%d)" | |
git push origin $BRANCH_NAME | |
echo "branch-name=$BRANCH_NAME" >> $GITHUB_OUTPUT | |
- name: Create a pull request | |
if: steps.git-state.outputs.changes == 'true' | |
uses: peter-evans/create-pull-request@v5 | |
with: | |
base: "master" | |
branch: ${{ steps.create-branch.outputs.branch-name }} | |
title: "Well-known headers update" | |
body: "This PR contains automated updates generated by the weekly workflow." |