Skip to content

Commit

Permalink
ci: fix project-autoadd github action (#5080)
Browse files Browse the repository at this point in the history
A fix for the [`project-autoadd` github action](https://github.com/MovingBlocks/Terasology/blob/develop/.github/workflows/project-autoadd.yml) which failed because the utilized underlying action only supports classic projects but we're using v2 (beta) projects. The replacement action not only works but is a base action provided by GitHub which hopefully means better maintenance and higher security awareness.

The action requires a token with control privileges for projects. I added such a token to the organization secrets and wrote a [maintainer guide](https://github.com/MovingBlocks/Terasology/wiki/Maintenance#how-to-fix-an-expired-github-action-token) on what to do in case the action starts failing because this token expired.
  • Loading branch information
jdrueckert authored Nov 26, 2022
1 parent e8380cf commit df98a45
Showing 1 changed file with 50 additions and 44 deletions.
94 changes: 50 additions & 44 deletions .github/workflows/project-autoadd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,51 +5,57 @@ on:
types: [opened, labeled]
pull_request:
types: [opened, labeled]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
assign_one_project:
add_opened_to_inbox_board:
name: Add New Issue/PR to Terasology Inbox Board
if: github.event.action == 'opened'
runs-on: ubuntu-latest
name: Assign to One Project
steps:

- name: Assign NEW issues and issues to bug/inbox board's inbox
uses: srggrs/assign-one-project-github-action@1.2.1
if: github.event.action == 'opened'
with:
project: 'https://github.com/srggrs/assign-one-project-github-action/projects/26'
column_name: 'New (Inbox)'

- name: Assign bug report issues and pull requests to bug board backlog
uses: srggrs/assign-one-project-github-action@1.2.1
if: |
contains(github.event.issue.labels.*.name, 'Type: Bug') ||
contains(github.event.pull_request.labels.*.name, 'Type: Bug')
with:
project: 'https://github.com/srggrs/assign-one-project-github-action/projects/26'
column_name: 'Backlog'

- name: Assign stabilization / refactoring / maintenance issues and pull requests to stabilization board backlog
uses: srggrs/assign-one-project-github-action@1.2.1
if: |
github.event.action != 'opened' &&
( contains(github.event.issue.labels.*.name, 'Type: Refactoring') ||
contains(github.event.pull_request.labels.*.name, 'Type: Refactoring') ||
contains(github.event.issue.labels.*.name, 'Type: Chore') ||
contains(github.event.pull_request.labels.*.name, 'Type: Chore') ||
contains(github.event.issue.labels.*.name, 'Topic: Stabilization') && !contains(github.event.issue.labels.*.name, 'Type: Bug') ||
contains(github.event.pull_request.labels.*.name, 'Topic: Stabilization') && !contains(github.event.pull_request.labels.*.name, 'Type: Bug') )
with:
project: 'https://github.com/srggrs/assign-one-project-github-action/projects/25'
column_name: 'Backlog'

- name: Assign improvement issues and pull requests to feature board backlog
uses: srggrs/assign-one-project-github-action@1.2.1
if: |
github.event.action != 'opened' &&
contains(github.event.issue.labels.*.name, 'Type: Improvement') && !contains(github.event.issue.labels.*.name, 'Topic: Stabilization') ||
contains(github.event.pull_request.labels.*.name, 'Type: Improvement') && !contains(github.event.pull_request.labels.*.name, 'Topic: Stabilization')
with:
project: 'https://github.com/srggrs/assign-one-project-github-action/projects/27'
column_name: 'Backlog'
- name: Add to inbox board
uses: actions/add-to-project@v0.3.0
with:
project-url: 'https://github.com/orgs/MovingBlocks/projects/26'
github-token: ${{ secrets.PROJECT_GITHUB_TOKEN }}
add_bug_labeled_to_bug_board:
name: Assign bug report issues and pull requests to bug board backlog
if: |
contains(github.event.issue.labels.*.name, 'Type: Bug') ||
contains(github.event.pull_request.labels.*.name, 'Type: Bug')
runs-on: ubuntu-latest
steps:
- name: Add to bug board
uses: actions/add-to-project@v0.3.0
with:
project-url: 'https://github.com/orgs/MovingBlocks/projects/29'
github-token: ${{ secrets.PROJECT_GITHUB_TOKEN }}
add_maintenance_to_stabilization_board:
name: Assign stabilization / refactoring / chore issues and pull requests to stabilization board backlog
if: |
github.event.action != 'opened' &&
( contains(github.event.issue.labels.*.name, 'Type: Refactoring') ||
contains(github.event.pull_request.labels.*.name, 'Type: Refactoring') ||
contains(github.event.issue.labels.*.name, 'Type: Chore') ||
contains(github.event.pull_request.labels.*.name, 'Type: Chore') ||
contains(github.event.issue.labels.*.name, 'Topic: Stabilization') && !contains(github.event.issue.labels.*.name, 'Type: Bug') ||
contains(github.event.pull_request.labels.*.name, 'Topic: Stabilization') && !contains(github.event.pull_request.labels.*.name, 'Type: Bug') )
runs-on: ubuntu-latest
steps:
- name: Add to stabilization board
uses: actions/add-to-project@v0.3.0
with:
project-url: 'https://github.com/orgs/MovingBlocks/projects/25'
github-token: ${{ secrets.PROJECT_GITHUB_TOKEN }}
add_features_to_feature_board:
name: Assign improvement issues and pull requests to feature board backlog
if: |
github.event.action != 'opened' &&
contains(github.event.issue.labels.*.name, 'Type: Improvement') && !contains(github.event.issue.labels.*.name, 'Topic: Stabilization') ||
contains(github.event.pull_request.labels.*.name, 'Type: Improvement') && !contains(github.event.pull_request.labels.*.name, 'Topic: Stabilization')
runs-on: ubuntu-latest
steps:
- name: Add to feature board
uses: actions/add-to-project@v0.3.0
with:
project-url: 'https://github.com/orgs/MovingBlocks/projects/27'
github-token: ${{ secrets.PROJECT_GITHUB_TOKEN }}

0 comments on commit df98a45

Please sign in to comment.