OUI-Updates #74
This file contains hidden or 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: "OUI-Updates" | |
| on: # yamllint disable-line rule:truthy | |
| schedule: | |
| - cron: "0 2 1 * *" | |
| workflow_dispatch: {} | |
| jobs: | |
| data_gathering: | |
| runs-on: "ubuntu-latest" | |
| env: | |
| BRANCH_NAME: "OUI_Updates" | |
| steps: | |
| - name: "Check out code" | |
| uses: "actions/checkout@v4" | |
| with: | |
| ref: "develop" | |
| fetch-depth: 0 | |
| - name: "Authenticate git remote" | |
| env: | |
| GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | |
| run: | | |
| git remote set-url origin "https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" | |
| - name: "Delete existing branch" | |
| run: | | |
| git branch -D "$BRANCH_NAME" || true | |
| - name: "Create branch" | |
| run: | | |
| git checkout -b "$BRANCH_NAME" | |
| - name: "Push branch" | |
| run: | | |
| git push -f --set-upstream origin "$BRANCH_NAME" | |
| # Fetch data via curl as IEEE has blocked requests/urllib library requests | |
| - name: "Download IEEE OUI data" | |
| run: | | |
| curl -fsSL "https://standards-oui.ieee.org/oui/oui.csv" \ | |
| -o "./netutils/data_files/oui_mappings.py" | |
| - name: "Generate oui_mappings.py" | |
| run: "python ./flat_postprocess/oui_postprocess.py ./netutils/data_files/oui_mappings.py" | |
| - name: "Commit changes" | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add ./netutils/data_files/oui_mappings.py | |
| git diff --cached --quiet || git commit -m "Update OUI mappings" | |
| - name: "Push changes" | |
| run: | | |
| git push origin "$BRANCH_NAME" | |
| pr_creation: | |
| runs-on: "ubuntu-latest" | |
| needs: "data_gathering" | |
| steps: | |
| # Checkout repo | |
| - name: "Check out code" | |
| uses: "actions/checkout@v4" | |
| with: | |
| ref: "OUI_Updates" | |
| # Create PR from branch created above into develop | |
| - name: "Create a Pull Request" | |
| run: "gh pr create -B develop -H OUI_Updates --title 'Flatbot OUI File Updates' --body 'Created by Flatbot action'" | |
| env: | |
| GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" |