Skip to content

Commit ccef388

Browse files
committed
build: add label while workflow is running
1 parent ccc2637 commit ccef388

File tree

1 file changed

+49
-2
lines changed

1 file changed

+49
-2
lines changed

.github/workflows/slash_commands.yml

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ on:
2929
# Workflow jobs:
3030
jobs:
3131

32-
# Add a new job for adding the initial reaction
32+
# Define a job for adding an initial reaction:
3333
add_initial_reaction:
3434

3535
# Define the type of virtual host machine:
@@ -40,7 +40,21 @@ jobs:
4040

4141
# Define the job's steps:
4242
steps:
43-
# Add initial reaction to the comment
43+
# Add "bot: In progress" label to the issue / PR:
44+
- name: 'Add in-progress label'
45+
# Pin action to full length commit SHA
46+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
47+
with:
48+
github-token: ${{ secrets.STDLIB_BOT_GITHUB_TOKEN }}
49+
script: |
50+
github.rest.issues.addLabels({
51+
owner: context.repo.owner,
52+
repo: context.repo.repo,
53+
issue_number: context.issue.number,
54+
labels: ['bot: In Progress']
55+
})
56+
57+
# Add initial reaction to comment with slash command:
4458
- name: 'Add initial reaction'
4559
run: |
4660
COMMENT="${{ github.event.comment.body }}"
@@ -176,3 +190,36 @@ jobs:
176190
177191
# GitHub token:
178192
token: ${{ secrets.STDLIB_BOT_GITHUB_TOKEN }}
193+
194+
# Define a job for removing the in-progress label:
195+
remove_progress_label:
196+
197+
# Define the type of virtual host machine:
198+
runs-on: ubuntu-latest
199+
200+
# Ensure all previous jobs have completed before running this job:
201+
needs: [ add_initial_reaction, check_files, update_copyright_years, fix_lint_errors, merge_develop, rebase_develop, help ]
202+
203+
# Define the conditions under which the job should run:
204+
if: github.event.issue.pull_request && startsWith( github.event.comment.body, '/stdlib' )
205+
206+
# Define the job's steps:
207+
steps:
208+
- name: Remove in-progress label
209+
# Run the step regardless of the outcome of previous steps:
210+
if: always()
211+
# Pin action to full length commit SHA
212+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
213+
with:
214+
github-token: ${{ secrets.STDLIB_BOT_GITHUB_TOKEN }}
215+
script: |
216+
try {
217+
await github.rest.issues.removeLabel({
218+
owner: context.repo.owner,
219+
repo: context.repo.repo,
220+
issue_number: context.issue.number,
221+
name: 'bot: In Progress'
222+
})
223+
} catch (error) {
224+
console.log( 'Error removing label:', error );
225+
}

0 commit comments

Comments
 (0)