Skip to content

Commit

Permalink
ci: maintain workflow (#15)
Browse files Browse the repository at this point in the history
* chore: Add CODEOWNERS file for Flutter project

* chore: Update dependabot schedule to weekly

* ci: Add linting for GitHub Actions workflows

* fix: Fix lint rules workflow job name

* ci: Fix action by actionlint
  • Loading branch information
riscait authored Feb 19, 2024
1 parent 241ce1c commit e499fe7
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 8 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @altive/flutter
11 changes: 8 additions & 3 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"
interval: "weekly"

- package-ecosystem: "pub"
directory: "/packages/altive_lints"
schedule:
interval: "monthly"
interval: "weekly"

- package-ecosystem: "pub"
directory: "/packages/altive_lints/example"
Expand All @@ -20,4 +20,9 @@ updates:
- package-ecosystem: "pub"
directory: "/packages/diffscrape"
schedule:
interval: "monthly"
interval: "weekly"
dependencies-patch:
patterns:
- "*"
update-types:
- "patch"
27 changes: 27 additions & 0 deletions .github/workflows/lint-github-actions-workflows.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Lint GitHub Actions workflows
on:
push:
branches: [main]
paths: ['.github/workflows/**']
pull_request:
types: [opened, synchronize, reopened]
paths: ['.github/workflows/**']
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
actionlint:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Download actionlint
id: get_actionlint
run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
shell: bash
- name: Check workflow files
run: ${{ steps.get_actionlint.outputs.executable }} -color
shell: bash
14 changes: 9 additions & 5 deletions .github/workflows/update-all-lint-rules.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ on:
- cron: '0 0 * * 3'
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
branch: "update-all-lint-rules"

Expand Down Expand Up @@ -36,7 +40,7 @@ jobs:
- name: Git config
if: env.diff_count != '0'
run: |
git remote set-url origin https://github-actions:${GH_TOKEN}@github.com/${GITHUB_REPOSITORY}
git remote set-url origin "https://github-actions:${GH_TOKEN}@github.com/${GITHUB_REPOSITORY}"
git config --global user.name "${GITHUB_ACTOR}"
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
- name: Commit & Push
Expand All @@ -52,20 +56,20 @@ jobs:
name: Create Pull-Request
runs-on: ubuntu-latest
needs: [update]
if: ${{ needs.diff.outputs.has_diff == 'true' }}
if: ${{ needs.update.outputs.has_diff == 'true' }}
steps:
- uses: actions/checkout@v4
- name: Generate GiHub App token
id: generate_token
uses: actions/create-github-app-token@v1
with:
app_id: ${{ secrets.PR_WRITER_APP_ID }}
private_key: ${{ secrets.PR_WRITER_PRIVATE_KEY }}
app-id: ${{ secrets.PR_WRITER_APP_ID }}
private-key: ${{ secrets.PR_WRITER_PRIVATE_KEY }}

- name: Create PR
env:
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
run: gh pr create -B $GITHUB_REF -t ${{ env.branch }} -b "" -a $GITHUB_ACTOR -H ${{ env.branch }}
run: gh pr create -B "$GITHUB_REF" -t "${{ env.branch }}" -b "" -a "$GITHUB_ACTOR" -H "${{ env.branch }}"

- name: Revoke GitHub Apps token
env:
Expand Down

0 comments on commit e499fe7

Please sign in to comment.