-
Notifications
You must be signed in to change notification settings - Fork 0
86 lines (80 loc) · 2.69 KB
/
tokens-diff.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
name: Check for token changes
on:
pull_request:
types: [opened, edited]
defaults:
run:
working-directory: packages/tokens
env:
YARN_ENABLE_IMMUTABLE_INSTALLS: false
jobs:
compare-tokens:
if: contains(github.event.pull_request.head.ref, 'dependabot/npm_and_yarn/packages/tokens/department-of-veterans-affairs/css-library')
runs-on: ubuntu-latest
steps:
- name: Check out the code
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
fetch-depth: 0
token: ${{ secrets.VA_MOBILE_ROBOT_GITHUB_PAT }}
- name: Set git credentials and regenerate yarn.lock
run: |
git config --global user.name 'VA Automation Bot'
git config --global user.email '[email protected]'
yarn install
if git status --porcelain | grep -q '^[ MARC].*yarn.lock'; then
echo "yarn.lock has unstaged changes."
cd ../..
git add yarn.lock
git commit -m 'Regenerate yarn.lock'
git push
fi
- name: Build and compare tokens
run: |
yarn tokens:build
cd dist/js
cp colors.js colors_new.js
git checkout main
yarn && yarn tokens:build
if diff -q colors.js colors_new.js > /dev/null; then
echo "Files have the same contents."
echo "TOKENS_CHANGED=false" >> $GITHUB_ENV
else
echo "Files have different contents."
echo "TOKENS_CHANGED=true" >> $GITHUB_ENV
fi
- name: Send slack message
id: slack
uses: slackapi/[email protected]
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_OAUTH_TOKEN }}
with:
channel-id: C062TM03HN2 # DSVA #va-mobile-library-alerts channel
payload: |
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*TEST* Dependabot found an update to *@department-of-veterans-affairs/css-library*"
}
},
{
"type": "context",
"elements": [
{
"type": "mrkdwn",
"text": "<${{ github.event.pull_request.html_url }}|Pull Request>"
},
{
"type": "mrkdwn",
"text": "*Tokens changed:* ${{ env.TOKENS_CHANGED }}"
}
]
}
],
"unfurl_links": false,
"unfurl_media": false
}