-
Notifications
You must be signed in to change notification settings - Fork 1
57 lines (45 loc) · 2.03 KB
/
collaborator_conflicts.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# This workflow will be run when an issue labeled "trigger-conflict" is closed.
name: Collaborator causes conflict
# Trigger a workflow for a closed issue
on:
issues:
types: [closed]
jobs:
# This job builds if the issue closure is labeled trigger-conflict
build_if_conflict:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Only run the job if the closed issue has the label "trigger-conflict"
# Idea borrowed from: https://github.community/t5/GitHub-Actions/Do-something-if-a-particular-label-is-set/td-p/40712
if: contains(github.event.issue.labels.*.name, 'trigger-conflict' )
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Seems like you need this first for all actions ...
- name: Checkout repository
uses: actions/checkout@v1
# Add the next story section to the file
# Purposely skip section & forget hyperlink
- name: Update dryville_story.md
run: |
function file_ends_with_newline() {
[[ $(tail -c1 "$1" | wc -l) -gt 0 ]]
}
if ! file_ends_with_newline ./dryville_story.md
then
echo "" >> ./dryville_story.md
fi
cat ./.github/commit_content/storing_water.md >> ./dryville_story.md
# Updating a file uses the GitHub action, https://github.com/marketplace/actions/update-files-on-github
- name: Commit updates to dryville_story.md
uses: test-room-7/action-update-file@v1
with:
file-path: dryville_story.md
commit-msg: add storing-water section
github-token: ${{ secrets.GITHUB_TOKEN }}
# Idea from https://github.community/t5/GitHub-Actions/Workflow-is-failing-if-no-job-can-be-ran-due-to-condition/td-p/38085
always_job:
name: Always run job
runs-on: ubuntu-latest
steps:
- name: Always run
run: echo "This job is used to prevent the worflow status from showing failed if the build_if_collab job is skipped."