Sync bang.js #86
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: Sync bang.js | |
| on: | |
| schedule: | |
| # Runs every 3 days at 00:15 | |
| - cron: "15 0 */3 * *" | |
| workflow_dispatch: | |
| jobs: | |
| sync-and-pr: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| with: | |
| persist-credentials: false | |
| - name: Setup Biome | |
| uses: biomejs/setup-biome@v2 | |
| - name: Fetch latest bang.js | |
| uses: wei/wget@v1 | |
| with: | |
| args: -O src/data/bang.json https://duckduckgo.com/bang.js | |
| - name: Format file | |
| run: biome format --write src/data/bang.json | |
| - name: Linting | |
| run: biome check | |
| - name: Check for changes | |
| id: changes | |
| run: | | |
| if [[ -n $(git status --porcelain) ]]; then | |
| echo "has_changes=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "has_changes=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Create Pull Request if changes exist | |
| if: steps.changes.outputs.has_changes == 'true' | |
| uses: peter-evans/create-pull-request@v8 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| commit-message: "chore: update bang.js from upstream" | |
| title: "chore: update bang.js from upstream" | |
| body: "This PR was automatically created after detecting changes in the upstream `bang.js` file." | |
| branch: "chore/sync-bangs" | |
| delete-branch: true | |
| # Assignee and labels | |
| assignees: finxol | |
| reviewers: finxol | |
| labels: bangs |